You are not logged in.

mikethedj4

Beginner

  • "mikethedj4" is male
  • "mikethedj4" started this thread

Posts: 12

Date of registration: Mar 24th 2010

Location: Rockford, IL

Occupation: Freelancer, Inventor

Hobbies: Programming, Design, Engineering, Dancing, and anything else I find to be fun...

  • Send private message

1

Wednesday, March 31st 2010, 12:16pm

Transparent Form

EDIT!
Well April fools day is coming up, and I'm making a simple app to prank my dad, but the only problem I'm coming across is, how can I make the form see threw at .01% in transparency???
Be the change you WANT to see in the world!

This post has been edited 2 times, last edit by "mikethedj4" (Mar 29th 2011, 8:29pm)


mikethedj4

Beginner

  • "mikethedj4" is male
  • "mikethedj4" started this thread

Posts: 12

Date of registration: Mar 24th 2010

Location: Rockford, IL

Occupation: Freelancer, Inventor

Hobbies: Programming, Design, Engineering, Dancing, and anything else I find to be fun...

  • Send private message

2

Tuesday, March 29th 2011, 8:29pm

Can anyone help me here?
Be the change you WANT to see in the world!

A1880

Intermediate

  • "A1880" is male

Posts: 500

Date of registration: Jan 1st 2009

Location: Hanover, Germany

Occupation: Software Engineer

Hobbies: Hilbert Curves

  • Send private message

3

Tuesday, March 29th 2011, 9:17pm

This could serve as startingpoint for your experiments:

Jabaco Source

1
2
3
4
5
Import com#sun#awt#AWTUtilities

Public Sub Command1_Click()
   setWindowOpacity Me.Parent, 0.5   
End Sub


Please post your findings!

Greetings

A1880

mikethedj4

Beginner

  • "mikethedj4" is male
  • "mikethedj4" started this thread

Posts: 12

Date of registration: Mar 24th 2010

Location: Rockford, IL

Occupation: Freelancer, Inventor

Hobbies: Programming, Design, Engineering, Dancing, and anything else I find to be fun...

  • Send private message

4

Thursday, March 31st 2011, 8:29pm

Awesome thanks!

Is there a way to hide the program from the taskbar???

Also is there a TopMost so I cam make it like task manager and have the program visible above all other applications???
Be the change you WANT to see in the world!

A1880

Intermediate

  • "A1880" is male

Posts: 500

Date of registration: Jan 1st 2009

Location: Hanover, Germany

Occupation: Software Engineer

Hobbies: Hilbert Curves

  • Send private message

5

Thursday, March 31st 2011, 11:44pm

The following code toggles your form between "fullscreen" and "normal" mode:

Jabaco Source

1
2
3
4
5
6
7
Public Sub Command1_Click()
   Me.Parent.setExtendedState JFrame.MAXIMIZED_BOTH   
End Sub

Public Sub Command2_Click()
   Me.Parent.setExtendedState JFrame.NORMAL   
End Sub


Fullscreen is actually hiding the taskbar.
Another option would be to set the taskbar to "auto-hide".

The following moves the form to the foreground or background:

Jabaco Source

1
2
3
4
5
6
7
Public Sub Command1_Click()
   Me.Parent.toFront 
End Sub

Public Sub Command2_Click()
   Me.Parent.toBack
End Sub


The "parent" of a "Form" is a JFrame.
Please ask Google to get to know the manifold of features available for JFrame.

Greetings

A1880

mikethedj4

Beginner

  • "mikethedj4" is male
  • "mikethedj4" started this thread

Posts: 12

Date of registration: Mar 24th 2010

Location: Rockford, IL

Occupation: Freelancer, Inventor

Hobbies: Programming, Design, Engineering, Dancing, and anything else I find to be fun...

  • Send private message

6

Wednesday, April 13th 2011, 6:59pm

Thanks, but lets say if the app isn't in fullscreen. How could it be hidden from the taskbar???

Example image I made on what I mean.
Be the change you WANT to see in the world!

spysonic

Trainee

  • "spysonic" is male

Posts: 88

Date of registration: Jul 11th 2014

About me: A beginner programmer.

Location: ...Jabaco Academy

Occupation: i have some but still not enough...

Hobbies: Jabaco

  • Send private message

7

Thursday, July 31st 2014, 4:39am

Is there a way to set the form transparent but the controls/objects inside the form remain 100% visible not affected??
.
.
Spare me, im new to Programming

spysonic

Trainee

  • "spysonic" is male

Posts: 88

Date of registration: Jul 11th 2014

About me: A beginner programmer.

Location: ...Jabaco Academy

Occupation: i have some but still not enough...

Hobbies: Jabaco

  • Send private message

8

Tuesday, August 12th 2014, 9:30am

ah ok now i get it!

from here ... Gradient Jlabel - How do I get text to appear?
.
.
Spare me, im new to Programming

theuserbl

Intermediate

Posts: 436

Date of registration: Dec 20th 2008

  • Send private message

9

Tuesday, August 12th 2014, 6:17pm

ah ok now i get it!

from here ... Gradient Jlabel - How do I get text to appear?


Does this Usercontrol helps you?


Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Dim myText As String = ""

Public Sub Usercontrol_Initialize()

End Sub


Public Sub paint(g As java#awt#Graphics)
  Dim width As Integer = Me.Parent.getWidth
  Dim height As Integer = Me.getHeight
  'Dim paint As New java#awt#GradientPaint(0, 0, Color.blue, width, height, Color.cyan, True)
  Dim paint As New java#awt#GradientPaint(0, 0, New Color(255,0,0,180), width, height, New Color(0,255,0,250), True)
  Dim g2d As java#awt#Graphics2D = Cast(g, java#awt#Graphics2D)
  Dim oldPaint As java#awt#Paint = g2d.getPaint
  g2d.setPaint(paint)
  g2d.fillRect(0,0,width,height)
  g2d.setPaint(oldPaint)
  
  Dim f As New java#awt#Font("Dialog", Font.BOLD, 40)
  Dim myFontMetrics As java#awt#FontMetrics = Me.getFontMetrics(f)
  
  g2d.setFont(f)
  Dim a As Single = 30
  Dim b As Single = 50
  Dim c As Single = myFontMetrics.stringWidth(myText)
  Dim d As Single = myFontMetrics.getHeight
  Dim gp As New java#awt#GradientPaint(a, b, Color.yellow, c, d, Color.red)
  g2d.setPaint(gp)
  g2d.drawString(myText, 20, 50)
End Sub

Public Property Get Caption() As String
  Caption = myText
End Property

Public Property Let Caption(s As String)
  myText = s
End Property


Greatings
theuserbl

spysonic

Trainee

  • "spysonic" is male

Posts: 88

Date of registration: Jul 11th 2014

About me: A beginner programmer.

Location: ...Jabaco Academy

Occupation: i have some but still not enough...

Hobbies: Jabaco

  • Send private message

10

Wednesday, August 13th 2014, 2:01am

I thought i'll be able to replicate the solution on Dani's sample but i couldnt. it doest recognize the "me.setOpaque(false). do i have to enable something to properly implement this properties?

thanks theusrbl, i'll try your sample hope i'll be able to properly run it. BTW do i have to enable something before running the code? (thanks again)
.
.
Spare me, im new to Programming

spysonic

Trainee

  • "spysonic" is male

Posts: 88

Date of registration: Jul 11th 2014

About me: A beginner programmer.

Location: ...Jabaco Academy

Occupation: i have some but still not enough...

Hobbies: Jabaco

  • Send private message

11

Wednesday, August 13th 2014, 5:40am

i successfully run the gradient form using usercontrol many thanks theusrbl -

but still my problems lies within obtaining transparent for with ilustrated here

Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import java.awt.*;import javax.swing.*;
import static java.awt.GraphicsDevice.WindowTranslucency.*;

public class GradientTranslucentWindowDemo extends JFrame {
    public GradientTranslucentWindowDemo() {
        super("GradientTranslucentWindow");

        setBackground(new Color(0,0,0,0));
        setSize(new Dimension(300,200));
        setLocationRelativeTo(null);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        JPanel panel = new JPanel() {
            @Override
            protected void paintComponent(Graphics g) {
                if (g instanceof Graphics2D) {
                    final int R = 240;
                    final int G = 240;
                    final int B = 240;

                    Paint p =
                        new GradientPaint(0.0f, 0.0f, new Color(R, G, B, 0),
                            0.0f, getHeight(), new Color(R, G, B, 255), true);
                    Graphics2D g2d = (Graphics2D)g;
                    g2d.setPaint(p);
                    g2d.fillRect(0, 0, getWidth(), getHeight());
                }
            }
        };
        setContentPane(panel);
        setLayout(new GridBagLayout());
        add(new JButton("I am a Button"));
    }

    public static void main(String[] args) {
        // Determine what the GraphicsDevice can support.
        GraphicsEnvironment ge = 
            GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice gd = ge.getDefaultScreenDevice();
        boolean isPerPixelTranslucencySupported = 
            gd.isWindowTranslucencySupported(PERPIXEL_TRANSLUCENT);

        //If translucent windows aren't supported, exit.
        if (!isPerPixelTranslucencySupported) {
            System.out.println(
                "Per-pixel translucency is not supported");
                System.exit(0);
        }

        JFrame.setDefaultLookAndFeelDecorated(true);

        // Create the GUI on the event-dispatching thread
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                GradientTranslucentWindowDemo gtw = new
                    GradientTranslucentWindowDemo();

                // Display the window.
                gtw.setVisible(true);
            }
        });
    } }


and my problem is converting this one to Jabaco.
spysonic has attached the following image:
  • perpixel trasparency.jpg
.
.
Spare me, im new to Programming

theuserbl

Intermediate

Posts: 436

Date of registration: Dec 20th 2008

  • Send private message

12

Wednesday, August 13th 2014, 8:06pm

but still my problems lies within obtaining transparent for with ilustrated here
Ok, ported it to Jabaco. Is the port good enough?

Important: To run that example you need at minimum Java 7 !
With Java 6, it will not run and aborts with an error, that some classes (of the Java-runtime) don't exist.
And Java 6 and lower don't support translucent windows.

Greatings
theuserbl
theuserbl has attached the following file:
  • Gradient.zip (4.96 kB - 168 times downloaded - latest: Jul 17th 2019, 1:51pm)

spysonic

Trainee

  • "spysonic" is male

Posts: 88

Date of registration: Jul 11th 2014

About me: A beginner programmer.

Location: ...Jabaco Academy

Occupation: i have some but still not enough...

Hobbies: Jabaco

  • Send private message

13

Thursday, August 14th 2014, 1:42am

Now That is what Transparency means

Woooaah Jaw droping... 8o

Many many thanks theusebl


This is great!
.
.
Spare me, im new to Programming

Rate this thread
WoltLab Burning Board