Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

run aplication with napkin look

843807Mar 29 2010 — edited Mar 29 2010
 import java.awt.*;
import javax.swing.*;

public class Main {
    public final static boolean RIGHT_TO_LEFT = false;

    public static void addComponentsToPane(Container contentPane) {
        if (RIGHT_TO_LEFT) {
            contentPane.setComponentOrientation(
                ComponentOrientation.RIGHT_TO_LEFT);
        }
//        Any number of rows and 2 columns
        contentPane.setLayout(new GridLayout(0,2));

        contentPane.add(new JLabel("JLabel 1"));
        contentPane.add(new JButton("JButton 2"));
        contentPane.add(new JCheckBox("JCheckBox 3"));
        contentPane.add(new JTextField("Long-Named JTextField 4"));
        contentPane.add(new JButton("JButton 5"));
    }

    private static void createAndShowGUI() {
        JFrame.setDefaultLookAndFeelDecorated(true);

        JFrame frame = new JFrame("GridLayout Source Demo");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        //Set up the content pane and components in GridLayout
        addComponentsToPane(frame.getContentPane());


        frame.pack();
        frame.setVisible(true);
    }

    public static void main(String[] args) {
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGUI();
            }
        });
    }
}
Iam trying that the above aplication , and replace the last part with the code below, i had change the class name , and tried several other things , but is simple didn't work,
can anyone give me an help with this
i had add napkin library to the library folder, just modify the code is making problem
public static void main(final String args[]) {
   java.awt.EventQueue.invokeLater(new Runnable() {
     public void run() {
      try {
        UIManager.setLookAndFeel(new NapkinLookAndFeel());
      } catch (UnsupportedLookAndFeelException ex) {
         ex.printStackTrace();
      }
      new ModelMat().setVisible(true);
     }
  });
} 
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 26 2010
Added on Mar 29 2010
18 comments
183 views