Java Code Examples for javax.swing.JFrame.setDefaultLookAndFeelDecorated()

The following are Jave code examples for showing how to use setDefaultLookAndFeelDecorated() of the javax.swing.JFrame class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: openjdk-jdk10   File: MaximizedFrameTest.java   View Source Code Vote up 7 votes
public void init() {
    JFrame.setDefaultLookAndFeelDecorated(true);

    try {
        UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
    } catch (ClassNotFoundException | InstantiationException |
            IllegalAccessException | UnsupportedLookAndFeelException ex) {
        throw new RuntimeException("Test Failed. MetalLookAndFeel not set "
                + "for frame");
    }

    frame = new JFrame("JFrame Maximization Test");
    frame.pack();
    frame.setSize(450, 260);
    frame.setVisible(true);
}
 
Example 2
Project: tomcat7   File: MapDemo.java   View Source Code Vote up 6 votes
/**
 * Create the GUI and show it.  For thread safety,
 * this method should be invoked from the
 * event-dispatching thread.
 */
public static SimpleTableDemo createAndShowGUI(
        LazyReplicatedMap<String,StringBuilder> map, String title) {
    //Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);

    //Create and set up the window.
    JFrame frame = new JFrame("SimpleTableDemo - "+title);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    //Create and set up the content pane.
    SimpleTableDemo newContentPane = new SimpleTableDemo(map);
    newContentPane.setOpaque(true); //content panes must be opaque
    frame.setContentPane(newContentPane);

    //Display the window.
    frame.setSize(450,250);
    newContentPane.setSize(450,300);
    frame.pack();
    frame.setVisible(true);
    return newContentPane;
}
 
Example 3
Project: PackagePlugin   File: MainFrame.java   View Source Code Vote up 6 votes
/**
 * @param args the command line arguments
 */
public static void main(String args[]) {
    /*
     * Create and display the form
     */
    JFrame.setDefaultLookAndFeelDecorated(true);
    JDialog.setDefaultLookAndFeelDecorated(true);
    EventQueue.invokeLater(new Runnable() {

        @Override
        public void run() {
            SubstanceLookAndFeel.setSkin(new CremeCoffeeSkin());
            MainFrame frame = new MainFrame();
            frame.initActionPerform();
            frame.initListSelectionListener();
            frame.setVisible(true);
        }
    });
}
 
Example 4
Project: OpenJSharp   File: Metalworks.java   View Source Code Vote up 6 votes
public static void main(String[] args) {
    UIManager.put("swing.boldMetal", Boolean.FALSE);
    JDialog.setDefaultLookAndFeelDecorated(true);
    JFrame.setDefaultLookAndFeelDecorated(true);
    Toolkit.getDefaultToolkit().setDynamicLayout(true);
    System.setProperty("sun.awt.noerasebackground", "true");
    try {
        UIManager.setLookAndFeel(new MetalLookAndFeel());
    } catch (UnsupportedLookAndFeelException e) {
        System.out.println(
                "Metal Look & Feel not supported on this platform. \n"
                + "Program Terminated");
        System.exit(0);
    }
    JFrame frame = new MetalworksFrame();
    frame.setVisible(true);
}
 
Example 5
Project: apache-tomcat-7.0.73-with-comment   File: MapDemo.java   View Source Code Vote up 6 votes
/**
 * Create the GUI and show it.  For thread safety,
 * this method should be invoked from the
 * event-dispatching thread.
 */
public static SimpleTableDemo createAndShowGUI(
        LazyReplicatedMap<String,StringBuilder> map, String title) {
    //Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);

    //Create and set up the window.
    JFrame frame = new JFrame("SimpleTableDemo - "+title);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    //Create and set up the content pane.
    SimpleTableDemo newContentPane = new SimpleTableDemo(map);
    newContentPane.setOpaque(true); //content panes must be opaque
    frame.setContentPane(newContentPane);

    //Display the window.
    frame.setSize(450,250);
    newContentPane.setSize(450,300);
    frame.pack();
    frame.setVisible(true);
    return newContentPane;
}
 
Example 6
Project: jdk8u-jdk   File: Metalworks.java   View Source Code Vote up 6 votes
public static void main(String[] args) {
    UIManager.put("swing.boldMetal", Boolean.FALSE);
    JDialog.setDefaultLookAndFeelDecorated(true);
    JFrame.setDefaultLookAndFeelDecorated(true);
    Toolkit.getDefaultToolkit().setDynamicLayout(true);
    System.setProperty("sun.awt.noerasebackground", "true");
    try {
        UIManager.setLookAndFeel(new MetalLookAndFeel());
    } catch (UnsupportedLookAndFeelException e) {
        System.out.println(
                "Metal Look & Feel not supported on this platform. \n"
                + "Program Terminated");
        System.exit(0);
    }
    JFrame frame = new MetalworksFrame();
    frame.setVisible(true);
}
 
Example 7
Project: openjdk-jdk10   File: Metalworks.java   View Source Code Vote up 6 votes
public static void main(String[] args) {
    UIManager.put("swing.boldMetal", Boolean.FALSE);
    JDialog.setDefaultLookAndFeelDecorated(true);
    JFrame.setDefaultLookAndFeelDecorated(true);
    Toolkit.getDefaultToolkit().setDynamicLayout(true);
    System.setProperty("sun.awt.noerasebackground", "true");
    try {
        UIManager.setLookAndFeel(new MetalLookAndFeel());
    } catch (UnsupportedLookAndFeelException e) {
        System.out.println(
                "Metal Look & Feel not supported on this platform. \n"
                + "Program Terminated");
        System.exit(0);
    }
    JFrame frame = new MetalworksFrame();
    frame.setVisible(true);
}
 
Example 8
Project: LinkGame   File: Main.java   View Source Code Vote up 5 votes
public static void main(String[] args) {
	JFrame.setDefaultLookAndFeelDecorated(true);
	JDialog.setDefaultLookAndFeelDecorated(true);
	try {
		UIManager.setLookAndFeel(new SubstanceOfficeBlue2007LookAndFeel());
	} catch (UnsupportedLookAndFeelException e) {
		e.printStackTrace();
	}
       System.out.println(111);
	initSetting();
	MenuFrame.open();
}
 
Example 9
Project: marathonv5   File: InternalFrameDemo.java   View Source Code Vote up 5 votes
/**
 * Create the GUI and show it. For thread safety, this method should be
 * invoked from the event-dispatching thread.
 */
private static void createAndShowGUI() {
    // Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);

    // Create and set up the window.
    InternalFrameDemo frame = new InternalFrameDemo();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // Display the window.
    frame.setVisible(true);
}
 
Example 10
Project: PTEAssistant   File: SkinManager.java   View Source Code Vote up 5 votes
public void initialize() throws Exception {
    String skin = ObjectUtils.toString(config.get("UISkin")).trim();
    String theme = ObjectUtils.toString(config.get("UITheme")).trim();
    
    if(skin.equalsIgnoreCase("default")) //java default
        return;
    
    UIManager.setLookAndFeel(new SubstanceLookAndFeel());
    JFrame.setDefaultLookAndFeelDecorated(true);
    JDialog.setDefaultLookAndFeelDecorated(true);
    
    if(StringUtils.isNotEmpty(theme))
        SubstanceLookAndFeel.setCurrentTheme(theme);
    else if(StringUtils.isNotEmpty(skin))
        SubstanceLookAndFeel.setSkin((SubstanceSkin)newInstance(skin));
    String watermark = ObjectUtils.toString(config.get("UIWatermark")).trim();
    if(StringUtils.isNotEmpty(watermark))
        SubstanceLookAndFeel.setCurrentWatermark((SubstanceWatermark)newInstance(watermark));
    String buttonShaper = ObjectUtils.toString(config.get("UIButtonShaper")).trim();
    if(StringUtils.isNotEmpty(buttonShaper))
        SubstanceLookAndFeel.setCurrentButtonShaper((SubstanceButtonShaper)newInstance(buttonShaper));
    String borderPainter = ObjectUtils.toString(config.get("UIBorderPainter")).trim();
    if(StringUtils.isNotEmpty(borderPainter))
        SubstanceLookAndFeel.setCurrentBorderPainter((SubstanceBorderPainter)newInstance(borderPainter));
    String gradientPainter = ObjectUtils.toString(config.get("UIGradientPainter")).trim();
    if(StringUtils.isNotEmpty(gradientPainter))
        SubstanceLookAndFeel.setCurrentGradientPainter((SubstanceGradientPainter)newInstance(gradientPainter));
}
 
Example 11
Project: AleCulator2   File: ABVCalc.java   View Source Code Vote up 5 votes
public static void main(String[] args) {
	
	//Call frame to build UI
	JFrame.setDefaultLookAndFeelDecorated(true);
	AleFrame frame = new AleFrame();
	frame.setVisible(true);
	frame.setResizable(false);
	
}
 
Example 12
Project: OverTale   File: ProjectMain.java   View Source Code Vote up 5 votes
public static void main(String[] args) {
	JFrame.setDefaultLookAndFeelDecorated(false);
	Screenwriter a = new Screenwriter();
	
}
 
Example 13
Project: 2048-java-swing   File: Main.java   View Source Code Vote up 5 votes
public static void main(String[] args) {
  JFrame.setDefaultLookAndFeelDecorated(true);
  /*
   * NAA.
   * This is procedural and imperative approach
   * https://stackoverflow.com/questions/26092495/jframe-setting-the-row-and-column-in-a-gridlayout
  JFrame frame = new JFrame("GridLayout Test");
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.setLayout(new GridLayout(3, 2));
  frame.add(new JButton("Button 1"));
  frame.add(new JButton("Button 2"));
  frame.add(new JButton("Button 3"));
  frame.add(new JButton("Button 4"));
  frame.add(new JButton("Button 5"));
  frame.add(new JButton("Button 6"));
  frame.add(new JButton("Button 7"));
  frame.add(new JButton("Button 8"));
  frame.pack();
  frame.setVisible(true);
  */
  
  /*
   * Let's try "wrapping" JFrame into a class and using a more object-oriented approach.
   * Learning objectives:
   * - Encapsulation
   * e.g., Use board to keep its own implementation details
   * - Inheritance
   * e.g., inherit traits from parent "super" class like JFrame
   * - Assigning behaviors
   * e.g., allow board to have behaviors
   */
  Board board = new Board(4,4);
  // stay open until close JFrame
}
 
Example 14
Project: brModelo   File: Aplicacao.java   View Source Code Vote up 5 votes
/**
 * @param args the command line arguments
 */
public static void main(String[] args) {
    initLookAndFeel();
    JFrame.setDefaultLookAndFeelDecorated(true);

    java.awt.EventQueue.invokeLater(new Runnable() {
        @Override
        public void run() {
            fmPrincipal = new FramePrincipal();
            fmPrincipal.setVisible(true);
        }
    });
}
 
Example 15
Project: JTouchBar   File: JTouchBarAWTTest.java   View Source Code Vote up 5 votes
@Test
public void test() {
	JTouchBar jTouchBar = JTouchBarTestUtils.constructTouchBar();
	assertNotNull(jTouchBar);
	
	JFrame.setDefaultLookAndFeelDecorated(true);
	
       final JFrame frame = new JFrame("JTouchBar");
       frame.pack();
       frame.setVisible(true);

       jTouchBar.show(frame);
}
 
Example 16
Project: betacome   File: Main.java   View Source Code Vote up 5 votes
/**
 * @param args the command line arguments
 */
public static void main(String args[])
{
  try
  {
    /* Set the Nimbus look and feel */
    //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
    /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
           * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
     */
    JFrame.setDefaultLookAndFeelDecorated(true);
    // UIManager.setLookAndFeel(new WindowsLookAndFeel());
    //</editor-fold>
  } catch (Exception ex)
  {
    Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
  }

  /* Create and display the form */
  java.awt.EventQueue.invokeLater(new Runnable()
  {

    @Override
    public void run()
    {
      Main m = new Main();
      m.setResizable(false);
      m.setVisible(true);
    }
  });
}
 
Example 17
Project: JavaMinicap   File: MainFrame.java   View Source Code Vote up 4 votes
public void init(){
		JFrame.setDefaultLookAndFeelDecorated(true);
		f = new JFrame();
		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		f.setPreferredSize(new Dimension(FRAME_WIDTH, FRAME_HEIGHT));
		f.setTitle("群控");       
		f.setResizable(true);   
		f.setLocationRelativeTo(null);
		
		jpControl = new JPanel();
		jbSendZone = new JButton("发送朋友圈");
		jpControl.add(jbSendZone);
		
		jpDevice = new JPanel();
//		jpDevice.setLayout(new FlowLayout(FlowLayout.LEADING, 20, 5));
		jpDevice.setLayout(new WrapLayout(WrapLayout.LEFT));
		Iterator<Entry<String, Thread>> iter = Devices.devices.entrySet().iterator();
		int port = 1313, count=0;
		while(iter.hasNext()){
			Map.Entry<String, Thread> entry = (Map.Entry<String, Thread>)iter.next();
			String serial = entry.getKey();
			JPanel jp = new JPanel();
			DrawImageThread dit = new DrawImageThread(serial, port++, jp);
			dit.start();			//启动绘制线程
			entry.setValue(dit);	//在device list中保存线程句柄
			
			count++;
			jpDevice.add(jp);
		}
		jspDevice = new JScrollPane(jpDevice);
		jspDevice.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
	
		jsp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, jpControl, jspDevice);
		jsp.setDividerLocation(0.3);
		jsp.setDividerSize(10);
		jsp.setOneTouchExpandable(true);
		f.add(jsp);
		
		f.pack();
		f.setVisible(true);
	}