Example #1
0
 private Object[] buttons() {
   ResourceBundle bundle = NbBundle.getBundle(PropertyAction.class);
   JButton okButton = new JButton();
   Mnemonics.setLocalizedText(okButton, bundle.getString("CTL_OK")); // NOI18N
   okButton
       .getAccessibleContext()
       .setAccessibleDescription(bundle.getString("ACSD_CTL_OK")); // NOI18N
   okButton.setActionCommand(OK_COMMAND);
   JButton cancelButton = new JButton();
   Mnemonics.setLocalizedText(cancelButton, bundle.getString("CTL_Cancel")); // NOI18N
   cancelButton
       .getAccessibleContext()
       .setAccessibleDescription(bundle.getString("ACSD_CTL_Cancel")); // NOI18N
   cancelButton.setActionCommand(CANCEL_COMMAND);
   if (property.isDefaultValue()) {
     if ("Aqua".equals(UIManager.getLookAndFeel().getID())) {
       return new Object[] {cancelButton, okButton};
     } else {
       return new Object[] {okButton, cancelButton};
     }
   } else {
     JButton restoreButton = new JButton();
     Mnemonics.setLocalizedText(restoreButton, bundle.getString("CTL_RestoreDefault")); // NOI18N
     restoreButton
         .getAccessibleContext()
         .setAccessibleDescription(bundle.getString("ACSD_CTL_RestoreDefault")); // NOI18N
     restoreButton.setActionCommand(RESTORE_COMMAND);
     if ("Aqua".equals(UIManager.getLookAndFeel().getID())) {
       return new Object[] {restoreButton, cancelButton, okButton};
     } else {
       return new Object[] {okButton, restoreButton, cancelButton};
     }
   }
 }
Example #2
0
  /**
   * Main method. Begins the GUI, and the rest of the program.
   *
   * @param args the command line arguments
   */
  public static void main(String args[]) {
    // playSound();
    try {
      for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
        if ("Nimbus".equals(info.getName())) {
          UIManager.setLookAndFeel(info.getClassName());
          break;
        }
      }
    } catch (ClassNotFoundException
        | InstantiationException
        | IllegalAccessException
        | UnsupportedLookAndFeelException ex) {
      Logger.getLogger(mainForm.class.getName()).log(Level.SEVERE, null, ex);
    }
    // </editor-fold>

    /* Create and display the form */
    EventQueue.invokeLater(
        new Runnable() {
          @Override
          public void run() {
            new mainForm().setVisible(true);
          }
        });
  }
 public MyRenderComponent(
     JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) {
   super();
   this.table = table;
   this.col = col;
   if (value != null) {
     setText(value.toString());
   } else {
     setText("");
   }
   setOpaque(false);
   setFont(UIManager.getFont("TableHeader.font"));
   setForeground(UIManager.getColor("TableHeader.foreground"));
   setHorizontalAlignment(JLabel.CENTER);
   setHorizontalTextPosition(SwingConstants.LEADING);
   setBorder(UIManager.getBorder("TableHeader.cellBorder"));
   if ((JTattooUtilities.getJavaVersion() >= 1.6)
       && (UIManager.getLookAndFeel() instanceof AbstractLookAndFeel)) {
     RowSorter rowSorter = table == null ? null : table.getRowSorter();
     List keyList = rowSorter == null ? null : rowSorter.getSortKeys();
     if ((keyList != null) && (keyList.size() > 0)) {
       RowSorter.SortKey sortKey = (RowSorter.SortKey) keyList.get(0);
       if (sortKey.getColumn() == table.convertColumnIndexToModel(col)) {
         AbstractIconFactory iconFactory =
             ((AbstractLookAndFeel) UIManager.getLookAndFeel()).getIconFactory();
         if (sortKey.getSortOrder().equals(SortOrder.ASCENDING)) {
           setIcon(iconFactory.getUpArrowIcon());
         } else if (sortKey.getSortOrder().equals(SortOrder.DESCENDING)) {
           setIcon(iconFactory.getDownArrowIcon());
         }
       }
     }
   }
   gv = ColorHelper.getGrayValue(AbstractLookAndFeel.getTheme().getRolloverColor());
 }
Example #4
0
 /**
  * Start the chooser.
  *
  * @param args command line parameters
  */
 public static void main(final String[] args) {
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
   } catch (Exception e) {
   }
   new TestChooser().start(args);
 }
Example #5
0
 public static void main(String[] args) {
   /* Use an appropriate Look and Feel */
   try {
     UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
     // UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
   } catch (UnsupportedLookAndFeelException ex) {
     ex.printStackTrace();
   } catch (IllegalAccessException ex) {
     ex.printStackTrace();
   } catch (InstantiationException ex) {
     ex.printStackTrace();
   } catch (ClassNotFoundException ex) {
     ex.printStackTrace();
   }
   /* Turn off metal's use of bold fonts */
   UIManager.put("swing.boldMetal", Boolean.FALSE);
   // Schedule a job for the event-dispatching thread:
   // adding TrayIcon.
   SwingUtilities.invokeLater(
       new Runnable() {
         public void run() {
           weather = new Wetter();
           createAndShowGUI();
         }
       });
 }
Example #6
0
 public MacRenderer() {
   renderer = new JLabel();
   renderer.setOpaque(Preferences.getBoolean("jeti", "bmw", true));
   renderer.setBackground(UIManager.getColor("Tree.selectionBackground"));
   renderer.setForeground(UIManager.getColor("Tree.textForeground"));
   renderer.setFont(UIManager.getFont("Tree.font"));
 }
 public static void main(String[] args) {
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
   } catch (Exception e) {
   }
   new TabbedDialog();
 }
Example #8
0
  private void init() {
    isExperimentalSheet = UIManager.getBoolean("Sheet.experimentalSheet");

    if (getOwner() != null && isShowAsSheet()) {
      if (isNativeSheetSupported()) {
        // J2SE 7 requires that we set undecorated to true.
        setUndecorated(true);
        getRootPane().putClientProperty("apple.awt.documentModalSheet", Boolean.TRUE);
      } else if (isExperimentalSheet()) {
        setUndecorated(true);
      } else {
        setUndecorated(true);
        getRootPane().setWindowDecorationStyle(JRootPane.NONE);
        getRootPane().setBorder(UIManager.getBorder("Sheet.border"));
      }
      if (isDocumentModalitySupported()) {
        Methods.invokeIfExistsWithEnum(
            this, "setModalityType", "java.awt.Dialog$ModalityType", "DOCUMENT_MODAL");
      }
    }

    // We move the sheet when the user moves the owner, so that it
    // will always stay centered below the title bar of the owner.
    // If the user has moved the owner, we 'forget' the shift back location,
    // and don't shift the owner back to the place it was, when we opened
    // the sheet.
    ownerMovementHandler =
        new ComponentAdapter() {

          @Override
          public void componentMoved(ComponentEvent evt) {
            Window owner = getOwner();
            Point newLocation = owner.getLocation();
            if (!newLocation.equals(oldLocation)) {
              setLocation(
                  newLocation.x + (owner.getWidth() - getWidth()) / 2,
                  newLocation.y + owner.getInsets().top);
              shiftBackLocation = null;
              oldLocation = newLocation;
            }
          }
        };

    // If the sheet is experimental, we need some special handling
    // so that the JSheet is handled correctly
    windowEventHandler =
        new WindowAdapter() {
          // public void windowIconified(WindowEvent e) {
          // TODO The sheet is reshown when the parent window is iconified.
          // setVisible(false) on the sheet only deiconifies the owner window.
          // }

          @Override
          public void windowActivated(WindowEvent e) {
            if (JSheet.this.isVisible() && JSheet.this.getOwner() == e.getWindow())
              JSheet.this.toFront();
          }
        };
  }
 public static void main(String args[]) {
   try {
     UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
   } catch (Exception e) {
   }
   JFrame mainscreenGUIframe = new Main_ScreenGUIFrame();
   mainscreenGUIframe.setVisible(true);
 }
 public static void main(String[] args) {
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
   } catch (Exception unused) {; // Ignore exception because we can't do anything. Will use
     // default.
   }
   new Dashboard();
 }
Example #11
0
 public static void main(String[] args) {
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
   } catch (Exception e) {
     System.err.println("Look and feel not set.");
   }
   new gui();
 }
 public static void main(String[] args) {
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
   } catch (Exception e) {
     String message = "ExceptionWhileSettingSystemLookAndFeel";
     Logging.logger().log(java.util.logging.Level.WARNING, message, e);
   }
   start("World Wind - elevations demo", AppFrame.class);
 }
 /** @param args command line params */
 public static void main(String[] args) {
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
     f = UIManager.getDefaults().getFont("TabbedPane.font");
     f = new Font(f.getFamily(), Font.BOLD, f.getSize());
   } catch (Exception x) {
   }
   new TestProgram().start();
 }
    public void paintIcon(Component c, Graphics g, int x, int y) {
      Color oldColor = g.getColor();
      boolean enabled = c.isEnabled();
      boolean pressed = false;
      if (c instanceof JButton) {
        pressed = ((JButton) c).getModel().isPressed();
      }

      int i = 0;
      int j = 0;
      int w = Math.min(width, c.getWidth());
      int h = c.getHeight();
      if (h < 5 || w < 5) { // not enough space for the arrow
        g.setColor(oldColor);
        return;
      }

      int size = Math.min(h / 2, w / 2);
      size = Math.max(size, 2);
      int mid = size / 2;

      x = ((w - size) / 2); // center arrow
      y = (h - size) / 2; // center arrow
      if (pressed) {
        x++;
        y++;
      }
      g.translate(x, y); // move the x,y origin in the graphic

      if (enabled) g.setColor(UIManager.getColor("controlDkShadow")); // NOT
      // LOCALIZABLE
      else g.setColor(UIManager.getColor("controlShadow")); // NOT
      // LOCALIZABLE

      if (!enabled) {
        g.translate(1, 1);
        g.setColor(UIManager.getColor("controlLtHighlight")); // NOT
        // LOCALIZABLE
        for (i = size - 1; i >= 0; i--) {
          g.drawLine(mid - i, j, mid + i, j);
          j++;
        }
        g.translate(-1, -1);
        g.setColor(UIManager.getColor("controlShadow")); // NOT
        // LOCALIZABLE
      }

      j = 0;
      for (i = size - 1; i >= 0; i--) {
        g.drawLine(mid - i, j, mid + i, j);
        j++;
      }

      g.translate(-x, -y);
      g.setColor(oldColor);
    }
 @Override
 protected void installDefaults() {
   UIManager.put("TabbedPane.selected", Color.BLACK);
   UIManager.put("TabbedPane.tabsOverlapBorder", true);
   super.installDefaults();
   tabInsets = new Insets(0, 0, 0, 0);
   contentBorderInsets = new Insets(0, 0, 0, 0);
   tabAreaInsets = new Insets(0, 0, 0, 0);
   selectedTabPadInsets = new Insets(0, 0, 0, 0);
 }
 private ActionMap getActionMap() {
   ActionMap actionMap = (ActionMap) UIManager.get("Grid.actionMap");
   if (actionMap == null) {
     actionMap = createActionMap();
     if (actionMap != null) {
       UIManager.put("Grid.actionMap", actionMap);
     }
   }
   return actionMap;
 }
 protected void installDefaults() {
   super.installDefaults();
   setFont(UIManager.getFont("InternalFrame.titleFont"));
   paletteTitleHeight = UIManager.getInt("InternalFrame.paletteTitleHeight");
   paletteCloseIcon = UIManager.getIcon("InternalFrame.paletteCloseIcon");
   wasClosable = frame.isClosable();
   selectedForegroundKey = selectedBackgroundKey = null;
   if (MetalLookAndFeel.usingOcean()) {
     setOpaque(true);
   }
 }
  private static Color getButtonBackgroundColor() {
    Color color;

    if (isUsingDarculaUIFlavor()) {
      color = UIManager.getColor("ComboBox.darcula.arrowFillColor");
    } else {
      color = UIManager.getColor("ComboBox.buttonBackground");
    }

    return color == null ? UIUtil.getControlColor() : color;
  }
 protected void installDefaults(JFileChooser fc) {
   installIcons(fc);
   installStrings(fc);
   usesSingleFilePane = UIManager.getBoolean("FileChooser.usesSingleFilePane");
   readOnly = UIManager.getBoolean("FileChooser.readOnly");
   TransferHandler th = fc.getTransferHandler();
   if (th == null || th instanceof UIResource) {
     fc.setTransferHandler(defaultTransferHandler);
   }
   LookAndFeel.installProperty(fc, "opaque", Boolean.FALSE);
 }
 protected void installDefaults() {
   LookAndFeel.installProperty(progressBar, "opaque", Boolean.TRUE);
   LookAndFeel.installBorder(progressBar, "ProgressBar.border");
   LookAndFeel.installColorsAndFont(
       progressBar, "ProgressBar.background", "ProgressBar.foreground", "ProgressBar.font");
   cellLength = UIManager.getInt("ProgressBar.cellLength");
   if (cellLength == 0) cellLength = 1;
   cellSpacing = UIManager.getInt("ProgressBar.cellSpacing");
   selectionForeground = UIManager.getColor("ProgressBar.selectionForeground");
   selectionBackground = UIManager.getColor("ProgressBar.selectionBackground");
 }
Example #21
0
    public void run() {
      try {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
      } catch (Exception e) {
        // do nothing - fall back to default look and feel
      }

      // load the issues and display the browser
      final IssuesBrowser browser = new IssuesBrowser();
      browser.setStartupArgs(args);
      browser.run();
    }
 public static void initLookAndFeel() {
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
   } catch (ClassNotFoundException e) {
     throw new RuntimeException(e);
   } catch (InstantiationException e) {
     throw new RuntimeException(e);
   } catch (IllegalAccessException e) {
     throw new RuntimeException(e);
   } catch (UnsupportedLookAndFeelException e) {
     throw new RuntimeException(e);
   }
 }
  private void createButtons() {
    myCloseButton =
        createButton("Close", UIManager.getIcon("InternalFrame.closeIcon"), myCloseAction);

    if (getWindowDecorationStyle() == JRootPane.FRAME) {
      myMaximizeIcon = UIManager.getIcon("InternalFrame.maximizeIcon");
      myMinimizeIcon = UIManager.getIcon("InternalFrame.minimizeIcon");

      myIconifyButton =
          createButton("Iconify", UIManager.getIcon("InternalFrame.iconifyIcon"), myIconifyAction);
      myToggleButton = createButton("Maximize", myMaximizeIcon, myRestoreAction);
    }
  }
 /** The run method sets up the GUI and calls methods to add its components. */
 public void run() {
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
     // matches the operating system's look and feel
   } catch (ClassNotFoundException
       | InstantiationException
       | IllegalAccessException
       | UnsupportedLookAndFeelException ex) {
   }
   setupPanels();
   setupFrame();
   listener.setGUI(this); // sets the DungeonListener object's reference to this class
 }
Example #25
0
 /** Installs the Kunststoff and Plastic Look And Feels if available in classpath. */
 private static void initializeLookAndFeels() {
   // if in classpath thry to load JGoodies Plastic Look & Feel
   try {
     UIManager.installLookAndFeel(
         "JGoodies Plastic 3D", "com.jgoodies.plaf.plastic.Plastic3DLookAndFeel");
     UIManager.setLookAndFeel("com.jgoodies.plaf.plastic.Plastic3DLookAndFeel");
   } catch (Throwable t) {
     try {
       UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
     } catch (Exception e) {
       e.printStackTrace();
     }
   }
 }
 public void paintComponent(Graphics g) {
   super.paintComponent(g);
   if (frame.isSelected()) {
     g.setColor(UIManager.getColor("activeCaptionText"));
   } else {
     g.setColor(UIManager.getColor("inactiveCaptionText"));
   }
   Dimension d = getSize();
   String frameTitle = frame.getTitle();
   if (frameTitle != null) {
     MotifGraphicsUtils.drawStringInRect(
         frame, g, frameTitle, 0, 0, d.width, d.height, SwingConstants.CENTER);
   }
 }
  public static void main(String args[]) {
    // UIManager.put("PopupMenu.border", new BorderUIResource.EmptyBorderUIResource(4,0,4,0));

    try {
      UIManager.setLookAndFeel(QuaquaManager.getLookAndFeelClassName());
      //   UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
    } catch (Exception e) {
      e.printStackTrace();
    }
    JFrame f = new JFrame("PopupMenuTest: " + UIManager.getLookAndFeel().getName());
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(new PopupMenuTest());
    f.pack();
    f.setVisible(true);
  }
Example #28
0
 // --------------------------------createAndShowGUI-----------------------------
 public static void createAndShowGUI() {
   Game thisGame = new Game();
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
   } catch (Exception e) {
   }
   JFrame.setDefaultLookAndFeelDecorated(true);
   thisGame.frame = new JFrame("Tactics");
   thisGame.oConn = new SocketManager();
   thisGame.scrBounds = thisGame.frame.getGraphicsConfiguration().getBounds();
   thisGame.frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
   thisGame.frame.setDefaultLookAndFeelDecorated(true);
   thisGame.frame.addWindowListener(thisGame);
   thisGame.frame.setVisible(true);
 }
Example #29
0
 public static void createAndShowGUI() {
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
   } catch (ClassNotFoundException
       | InstantiationException
       | IllegalAccessException
       | UnsupportedLookAndFeelException ex) {
     ex.printStackTrace();
   }
   JFrame frame = new JFrame("@title@");
   frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
   frame.getContentPane().add(new MainPanel());
   frame.pack();
   frame.setLocationRelativeTo(null);
   frame.setVisible(true);
 }
 private synchronized void dispose() {
   timer.stop();
   UIManager.removePropertyChangeListener(this);
   synchronized (AnimationController.class) {
     AppContext.getAppContext().put(ANIMATION_CONTROLLER_KEY, null);
   }
 }