コード例 #1
0
 /** Sets the current L&F on each demo module */
 public void updateLookAndFeel() {
   try {
     UIManager.setLookAndFeel(currentLookAndFeel);
     SwingUtilities.updateComponentTreeUI(this);
   } catch (Exception ex) {
     System.out.println("Failed loading L&F: " + currentLookAndFeel);
     System.out.println(ex);
   }
 }
コード例 #2
0
  public reminder(int m, int y, int m3, int y3) {
    m1 = m;
    y1 = y;
    m2 = m3;
    y2 = y3;

    try {
      f.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("skrm.jpg")));
      String cn = UIManager.getSystemLookAndFeelClassName();

      UIManager.setLookAndFeel(cn); // Use the native L&F
    } catch (Exception cnf) {
      System.out.println(cnf);
    }

    f = new JFrame("Print Reminders");
    f.setVisible(true);
    f.setLayout(null);
    f.setSize(300, 100);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }
        });
    b = new JButton("Print Reminders");
    b.addActionListener(this);
    back = new JButton("Back");
    back.addActionListener(this);
    f.add(b);
    b.setBounds(10, 10, 100, 20);
    b.setMnemonic('P');
    f.add(back);
    back.setMnemonic('B');
    back.setBounds(150, 10, 100, 20);
    // f.pack();

  }