How to make a window look like Java?

How to create a window that looks like this in Java:

frame

I need this window layout, not the standard Windows borders, and I don't know what it's called.

Edit: appearance and feeling don't work for me:

not working for me

+6
java swing look-and-feel
source share
5 answers

If you want your Look and Feel to draw a window decor (called a "border"), you need to call JFrame.setDefaultLookAndFeelDecorated(true) before , creating JFrame objects and JDialog.setDefaultLookAndFeelDecorated(true) before , creating your JDialog objects.

+10
source share

called appearance, you can find a detailed explanation here http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html

+3
source share

You will need to first configure the appearance and appearance of the cross-platform interface (as someone commented before he called the metal). Then, before creating the frame, you need to request that the borders be drawn in appearance.

 try { UIManager.setLookAndFeel( UIManager.getCrossPlatformLookAndFeelClassName()); } catch (Exception e) { } 

It will look the way you want. Since the cross-platform appearance is metallic in Sun JRE.

 // Get window decorations drawn by the look and feel. JFrame.setDefaultLookAndFeelDecorated(true); // Create the JFrame. JFrame frame = new JFrame("A window"); 

And this will make the created JFrame have borders as you describe.

+2
source share

To set the window view to the swing view, write the following code in the main method.

public static void main (String args []) {
try {

  for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("windows".equalsIgnoreCase(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception ex) { System.out.println(e); } java.awt.EventQueue.invokeLater(new Runnable() { public void run() { MainFrame mainFrame = new MainFrame(); mainFrame.setExtendedState(MAXIMIZED_BOTH); mainFrame.setVisible(true); InitDatabaseDialog initDatabaseDialog = new InitDatabaseDialog(mainFrame, true); initDatabaseDialog.setVisible(true); } }); } 
0
source share

Add this to your main () method:

 try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Windows".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(testjframe.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(testjframe.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(testjframe.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(testjframe.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } 
0
source share

All Articles