Dear visitor, welcome to Jabaco - Community. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.
Beginner
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...
This post has been edited 2 times, last edit by "mikethedj4" (Mar 29th 2011, 8:29pm)
Intermediate
Date of registration: Jan 1st 2009
Location: Hanover, Germany
Occupation: Software Engineer
Hobbies: Hilbert Curves
Jabaco Source |
|
1 2 3 4 5 |
Import com#sun#awt#AWTUtilities Public Sub Command1_Click() setWindowOpacity Me.Parent, 0.5 End Sub |
Beginner
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...
Intermediate
Date of registration: Jan 1st 2009
Location: Hanover, Germany
Occupation: Software Engineer
Hobbies: Hilbert Curves
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 |
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 |
Trainee
Date of registration: Jul 11th 2014
About me: A beginner programmer.
Location: ...Jabaco Academy
Occupation: i have some but still not enough...
Hobbies: Jabaco
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 |
Trainee
Date of registration: Jul 11th 2014
About me: A beginner programmer.
Location: ...Jabaco Academy
Occupation: i have some but still not enough...
Hobbies: Jabaco
Trainee
Date of registration: Jul 11th 2014
About me: A beginner programmer.
Location: ...Jabaco Academy
Occupation: i have some but still not enough...
Hobbies: Jabaco
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); } }); } } |
Ok, ported it to Jabaco. Is the port good enough?but still my problems lies within obtaining transparent for with ilustrated here
Trainee
Date of registration: Jul 11th 2014
About me: A beginner programmer.
Location: ...Jabaco Academy
Occupation: i have some but still not enough...
Hobbies: Jabaco