示例#1
1
  public DialogPanel(boolean canok, boolean cancancel) {
    super(new GridBagLayout());
    actions = new LinkedHashMap<String, Action>();
    keystrokes = new HashMap<KeyStroke, String>();

    if (canok) {
      addButton(
          "ok",
          UIManager.getString("OptionPane.okButtonText"),
          KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),
          new AbstractAction() {
            public void actionPerformed(ActionEvent e) {
              acceptDialog();
            }
          });
      keystrokes.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.CTRL_MASK), "ok");
    }

    if (cancancel) {
      addButton(
          "cancel",
          UIManager.getString("OptionPane.cancelButtonText"),
          KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
          new AbstractAction() {
            public void actionPerformed(ActionEvent e) {
              cancelDialog();
            }
          });
      keystrokes.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, InputEvent.CTRL_MASK), "cancel");
    }
  }
示例#2
0
  public static void main(String[] args) {
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e) {
      e.printStackTrace();
    }

    network = false;
    one = new Player();
    two = new Player();

    /* path di installazione del gioco */
    String gamePath = new File("").getAbsolutePath();

    /* caricamento delle impostazioni e assegnazione delle variabili */
    File gameCfg = new File(gamePath + "/cfg.txt");
    loadCfg(gameCfg);

    /* caricamento della lista di mosse in un array */
    moves = new int[42];
    marker = 0;
    File saveCfg = new File(gamePath + "/save.txt");
    /*
     * in rete non viene considerata l'ultima partita giocata; altrimenti
     * viene caricata - se precedentemente non era stata conclusa
     */
    if (saveCfg.exists() && !network) loadMoveList(saveCfg);
    else for (int i = 0; i < moves.length; i++) moves[i] = -1;

    /* inizializzazione grafica e costruzione della griglia di gioco */
    new CFApp();
  }
  /** @param args the command line arguments */
  public static void main(String args[]) {
    /* 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
     */
    try {
      for (javax.swing.UIManager.LookAndFeelInfo info :
          javax.swing.UIManager.getInstalledLookAndFeels()) {
        if ("Nimbus".equals(info.getName())) {
          javax.swing.UIManager.setLookAndFeel(info.getClassName());
          break;
        }
      }
    } catch (ClassNotFoundException ex) {
      java.util.logging.Logger.getLogger(FrameLoading.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    } catch (InstantiationException ex) {
      java.util.logging.Logger.getLogger(FrameLoading.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    } catch (IllegalAccessException ex) {
      java.util.logging.Logger.getLogger(FrameLoading.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
      java.util.logging.Logger.getLogger(FrameLoading.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    }
    // </editor-fold>

    /* Create and display the form */

  }
示例#4
0
 public static void setJavaLookAndFeel() {
   try {
     UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
   } catch (Exception e) {
     System.out.println("Error setting Java LAF: " + e);
   }
 }
示例#5
0
 public MacOSController() {
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
示例#6
0
  /** Installs the JGoodies Look & Feels, if available, in classpath. */
  public final void initializeLookAndFeels() {
    // if in classpath thry to load JGoodies Plastic Look & Feel
    try {
      LookAndFeelInfo[] lnfs = UIManager.getInstalledLookAndFeels();
      boolean found = false;
      for (int i = 0; i < lnfs.length; i++) {
        if (lnfs[i].getName().equals("JGoodies Plastic 3D")) {
          found = true;
        }
      }
      if (!found) {
        UIManager.installLookAndFeel(
            "JGoodies Plastic 3D", "com.jgoodies.looks.plastic.Plastic3DLookAndFeel");
      }
      String os = System.getProperty("os.name");
      FontSet fontSet = null;
      if (os.startsWith("Windows")) {
        fontSet = FontSets.createDefaultFontSet(new Font("arial unicode MS", Font.PLAIN, 12));
      } else {
        fontSet = FontSets.createDefaultFontSet(new Font("arial unicode", Font.PLAIN, 12));
      }
      FontPolicy fixedPolicy = FontPolicies.createFixedPolicy(fontSet);
      PlasticLookAndFeel.setFontPolicy(fixedPolicy);

      UIManager.setLookAndFeel("com.jgoodies.looks.plastic.Plastic3DLookAndFeel");
    } catch (Throwable t) {
      try {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  }
  public static void main(String args[]) {

    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
        | InstantiationException
        | IllegalAccessException
        | javax.swing.UnsupportedLookAndFeelException ex) {
      java.util.logging.Logger.getLogger(TelaVenda.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    }

    java.awt.EventQueue.invokeLater(
        new Runnable() {
          @Override
          public void run() {
            new TelaVenda().setVisible(true);
          }
        });
  }
示例#8
0
 /** Installs extra LAFs. */
 private static void installExtraLAFs() {
   UIManager.installLookAndFeel("Office 2003", "org.fife.plaf.Office2003.Office2003LookAndFeel");
   UIManager.installLookAndFeel("Office XP", "org.fife.plaf.OfficeXP.OfficeXPLookAndFeel");
   UIManager.installLookAndFeel(
       "Visual Studio 2005", "org.fife.plaf.VisualStudio2005.VisualStudio2005LookAndFeel");
   UIManager.installLookAndFeel("Squareness", "net.beeger.squareness.SquarenessLookAndFeel");
 }
示例#9
0
 public HighlightRenderer() {
   super();
   match = "";
   regular = (Font) UIManager.get("Label.font");
   bold = ((Font) UIManager.get("Label.font")).deriveFont(Font.BOLD, 12.0f);
   mygray = new Color(240, 240, 240);
 }
示例#10
0
  public static void main(final String[] args) {
    List<String> names = new ArrayList<String>();
    names.add("Michael");
    names.add("Stephen");
    names.add("Josh");
    names.add("Will");
    ModelFacade.createInstance(new Model(false, false, false, false, names));

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

    SwingUtilities.invokeLater(
        new Runnable() {
          public void run() {
            new Catan();

            PlayerWaitingView playerWaitingView = new PlayerWaitingView();
            final PlayerWaitingController playerWaitingController =
                new PlayerWaitingController(playerWaitingView);
            playerWaitingView.setController(playerWaitingController);

            JoinGameView joinView = new JoinGameView();
            NewGameView newGameView = new NewGameView();
            SelectColorView selectColorView = new SelectColorView();
            MessageView joinMessageView = new MessageView();
            final JoinGameController joinController =
                new JoinGameController(joinView, newGameView, selectColorView, joinMessageView);
            joinController.setJoinAction(
                new IAction() {
                  @Override
                  public void execute() {
                    playerWaitingController.start();
                  }
                });
            joinView.setController(joinController);
            newGameView.setController(joinController);
            selectColorView.setController(joinController);
            joinMessageView.setController(joinController);

            LoginView loginView = new LoginView();
            MessageView loginMessageView = new MessageView();
            LoginController loginController = new LoginController(loginView, loginMessageView);
            loginController.setLoginAction(
                new IAction() {
                  @Override
                  public void execute() {
                    joinController.start();
                  }
                });
            loginView.setController(loginController);
            loginView.setController(loginController);

            ClientServerFacade.createInstance("localhost:8081");
            loginController.start();
          }
        });
  }
示例#11
0
  public static String getDefaultLookAndFeelClassName() {
    switch (UiMode.getCurrentUiMode()) {
      case SWING:
        String className = UIManager.getSystemLookAndFeelClassName();

        // if the default look and feel is the cross-platform one, we might
        // need to correct this choice. E.g. - KDE, where GTK look and feel
        // would be much more appropriate
        if (className.equals(UIManager.getCrossPlatformLookAndFeelClassName())) {

          // if the current platform is Linux and the desktop manager is
          // KDE, then we should try to use the GTK look and feel
          try {
            if (System.getProperty("os.name").contains("Linux")
                && (System.getenv("KDE_FULL_SESSION") != null)) {
              // check whether the GTK look and feel class is
              // available -- we'll get CNFE if it is not and it will
              // not be set
              Class.forName(LookAndFeelType.GTK.getClassName());

              className = LookAndFeelType.GTK.getClassName();
            }
          } catch (ClassNotFoundException e) {
            ErrorManager.notifyDebug(
                ResourceUtils.getString(UiUtils.class, RESOURCE_FAILED_TO_FORCE_GTK), e);
          }
        }

        return className;
      default:
        return null;
    }
  }
示例#12
0
  protected void installDefaults() {
    super.installDefaults();

    scrollBarWidth = UIManager.getInt("ScrollBar.width");
    incrGap = UIManager.getInt("ScrollBar.incrementButtonGap");
    decrGap = UIManager.getInt("ScrollBar.decrementButtonGap");

    // TODO this can be removed when incrGap/decrGap become protected
    // handle scaling for sizeVarients for special case components. The
    // key "JComponent.sizeVariant" scales for large/small/mini
    // components are based on Apples LAF
    String scaleKey = (String) scrollbar.getClientProperty("JComponent.sizeVariant");
    if (scaleKey != null) {
      if ("large".equals(scaleKey)) {
        scrollBarWidth *= 1.15;
        incrGap *= 1.15;
        decrGap *= 1.15;
      } else if ("small".equals(scaleKey)) {
        scrollBarWidth *= 0.857;
        incrGap *= 0.857;
        decrGap *= 0.857;
      } else if ("mini".equals(scaleKey)) {
        scrollBarWidth *= 0.714;
        incrGap *= 0.714;
        decrGap *= 0.714;
      }
    }
  }
示例#13
0
 public static void main(String args[]) {
   try {
     UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
   } catch (Exception e) {
   }
   SwingUtilities.invokeLater(QLearning::new);
 }
  public static void main(String[] args) {
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception localException) {
    }

    LauncherFrame launcherFrame = new LauncherFrame();
    launcherFrame.setVisible(true);
    launcherFrame.customParameters.put("stand-alone", "true");

    if (args.length >= 3) {
      String ip = args[2];
      String port = "25565";
      if (ip.contains(":")) {
        String[] parts = ip.split(":");
        ip = parts[0];
        port = parts[1];
      }
      launcherFrame.customParameters.put("server", ip);
      launcherFrame.customParameters.put("port", port);
    }
    if (args.length >= 1) {
      launcherFrame.loginForm.userName.setText(args[0]);
      if (args.length >= 2) launcherFrame.loginForm.doLogin();
    }
  }
示例#15
0
  /** @param args the command line arguments */
  public static void main(String[] args) {
    System.out.println("Starting RecipeSearch");
    try {
      for (javax.swing.UIManager.LookAndFeelInfo info :
          javax.swing.UIManager.getInstalledLookAndFeels()) {
        if ("Nimbus".equals(info.getName())) {
          javax.swing.UIManager.setLookAndFeel(info.getClassName());
          break;
        }
      }
    } catch (ClassNotFoundException
        | InstantiationException
        | IllegalAccessException
        | javax.swing.UnsupportedLookAndFeelException ex) {
      java.util.logging.Logger.getLogger(RecipeSearchView.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    }

    new RecipeSearchView().setVisible(true);

    Runtime.getRuntime()
        .addShutdownHook(
            new Thread(
                new Runnable() {
                  @Override
                  public void run() {
                    // This code will run before shutdown
                    System.out.println("Closing RecipeSearch");
                  }
                }));
  }
示例#16
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();
         }
       });
 }
示例#17
0
 { // Systemlook
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
示例#18
0
  /** @param args the command line arguments */
  public static void main(String args[]) {

    try {
      for (javax.swing.UIManager.LookAndFeelInfo info :
          javax.swing.UIManager.getInstalledLookAndFeels()) {
        if ("Nimbus".equals(info.getName())) {
          javax.swing.UIManager.setLookAndFeel(info.getClassName());
          break;
        }
      }
    } catch (ClassNotFoundException ex) {
      java.util.logging.Logger.getLogger(Config.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    } catch (InstantiationException ex) {
      java.util.logging.Logger.getLogger(Config.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    } catch (IllegalAccessException ex) {
      java.util.logging.Logger.getLogger(Config.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
      java.util.logging.Logger.getLogger(Config.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    }
    // </editor-fold>

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

          public void run() {
            new Config(Main.getLocale()).setVisible(true);
          }
        });
  }
示例#19
0
  /** Creates new form CallForm */
  public Controller() {
    try {
      for (javax.swing.UIManager.LookAndFeelInfo info :
          javax.swing.UIManager.getInstalledLookAndFeels()) {
        if ("Nimbus".equals(info.getName())) {
          javax.swing.UIManager.setLookAndFeel(info.getClassName());
          break;
        }
      }
    } catch (ClassNotFoundException
        | InstantiationException
        | IllegalAccessException
        | UnsupportedLookAndFeelException ex) {
      logger.log(java.util.logging.Level.SEVERE, ex.getMessage(), ex);
    }
    initComponents();
    this.setVisible(true);
    this.setLocationRelativeTo(null);
    this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);

    this.addWindowListener(
        new java.awt.event.WindowAdapter() {
          @Override
          public void windowClosing(java.awt.event.WindowEvent windowEvent) {
            if (cancelButton.isEnabled()) {
              setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
              System.exit(0);
            }
          }
        });
  }
示例#20
0
 /** Sets the Look and Feel to the Systems Look and Feel */
 private void setLookAndFeel() {
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
   } catch (Exception e) {
     System.err.println(e);
   }
 }
示例#21
0
 private void setDefaultLnF() {
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
  protected void applyDefaults() {

    expandedIcon =
        new ArrowIcon(ArrowIcon.SOUTH, UIManager.getColor(CourierSystem.TITLE_FOREGROUND_KEY));
    collapsedIcon =
        new ArrowIcon(ArrowIcon.EAST, UIManager.getColor(CourierSystem.TITLE_FOREGROUND_KEY));

    setBorder(
        new MatteBorder(0, 0, 0, 1, UIManager.getColor(CourierSystem.CONTROL_MID_SHADOW_KEY)));

    if (titlePanel != null) {
      titlePanel.setGradientColor1(UIManager.getColor(CourierSystem.TITLE_GRADIENT_COLOR1_KEY));
      titlePanel.setGradientColor2(UIManager.getColor(CourierSystem.TITLE_GRADIENT_COLOR2_KEY));
    }

    if (demoListLabel != null) {
      demoListLabel.setForeground(UIManager.getColor(CourierSystem.TITLE_FOREGROUND_KEY));
      demoListLabel.setFont(UIManager.getFont(CourierSystem.TITLE_FONT_KEY));
    }
    if (viewPanel != null) {
      viewPanel.setBackground(UIManager.getColor(CourierSystem.SUB_PANEL_BACKGROUND_KEY));
    }
    if (collapsePanels != null) {
      for (CollapsiblePanel collapsePanel : collapsePanels) {
        collapsePanel.setFont(UIManager.getFont("CheckBox.font").deriveFont(Font.BOLD));
        collapsePanel.setForeground(UIManager.getColor(CourierSystem.TITLE_FOREGROUND_KEY));
        collapsePanel.setExpandedIcon(expandedIcon);
        collapsePanel.setCollapsedIcon(collapsedIcon);
      }
    }
    revalidate();
  }
 public Component getTableCellRendererComponent(
     JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
   final Color color = UIUtil.getTableFocusCellBackground();
   Component component;
   final Module module = value instanceof Module ? (Module) value : null;
   try {
     UIManager.put(UIUtil.TABLE_FOCUS_CELL_BACKGROUND_PROPERTY, table.getSelectionBackground());
     component =
         super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
     if (module != null) {
       setText(
           module.getName()
               + " ("
               + FileUtil.toSystemDependentName(module.getModuleFilePath())
               + ")");
     }
     if (component instanceof JLabel) {
       ((JLabel) component).setBorder(noFocusBorder);
     }
   } finally {
     UIManager.put(UIUtil.TABLE_FOCUS_CELL_BACKGROUND_PROPERTY, color);
   }
   component.setEnabled(ProcessedModulesTable.this.isEnabled());
   if (component instanceof JLabel) {
     final Icon icon = module != null ? ModuleType.get(module).getIcon() : null;
     JLabel label = (JLabel) component;
     label.setIcon(icon);
     label.setDisabledIcon(icon);
   }
   component.setForeground(isSelected ? table.getSelectionForeground() : table.getForeground());
   return component;
 }
 @Override
 protected void paintComponent(Graphics g) {
   if (isSelected()) {
     setBackground(UIManager.getColor("Tree.selectionBackground"));
     g.setColor(UIManager.getColor("Tree.selectionBackground"));
     Dimension size = getSize();
     g.fillRect(0, 0, size.width, size.height);
     setForeground(UIManager.getColor("Tree.selectionForeground"));
   } else {
     setBackground(UIManager.getColor("ToggleButton.background"));
     Color foreground = UIManager.getColor("ToggleButton.foreground");
     switch (demo.getState()) {
       case STOPPED:
         {
           foreground = visitedForeground;
           break;
         }
       case FAILED:
         {
           foreground = failedForeground;
         }
     }
     setForeground(foreground);
   }
   super.paintComponent(g);
 }
示例#25
0
 /**
  * Tell system to use native look and feel, as in previous releases. Metal (Java) LAF is the
  * default otherwise.
  */
 public static void setNativeLookAndFeel() {
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
   } catch (Exception e) {
     System.out.println("Error setting native LAF: " + e);
   }
 }
  protected JComponent createTitleArea(String demoSetTitle) {
    JPanel titleAreaPanel = new JPanel(new BorderLayout());
    titlePanel =
        new GradientPanel(
            UIManager.getColor(CourierSystem.TITLE_GRADIENT_COLOR1_KEY),
            UIManager.getColor(CourierSystem.TITLE_GRADIENT_COLOR2_KEY));
    titlePanel.setLayout(new BorderLayout());
    titlePanel.setBorder(panelBorder);
    demoListLabel = new JLabel(demoSetTitle);
    demoListLabel.setOpaque(false);
    demoListLabel.setHorizontalAlignment(JLabel.LEADING);
    titlePanel.add(demoListLabel, BorderLayout.CENTER);
    titleAreaPanel.add(titlePanel, BorderLayout.NORTH);

    // Add panel with view combobox
    viewPanel = new JPanel();
    viewPanel.setLayout(new BoxLayout(viewPanel, BoxLayout.X_AXIS));
    viewPanel.setBorder(new CompoundBorder(chiselBorder, new EmptyBorder(12, 8, 12, 8)));
    JLabel viewLabel = new JLabel("Hi:");
    viewPanel.add(viewLabel);
    viewPanel.add(Box.createHorizontalStrut(6));
    JLabel viewComboBox = new JLabel();
    viewComboBox.setText(args[1].toUpperCase().toString());
    //        viewComboBox.addItem("By Category");
    viewPanel.add(viewComboBox);
    titleAreaPanel.add(viewPanel, BorderLayout.CENTER);

    return titleAreaPanel;
  }
示例#27
0
 /**
  * Determines and answers the header's background color. Tries to lookup a special color from the
  * L&amp;F. In case it is absent, it uses the standard internal frame background.
  *
  * @return the color of the header's background
  */
 protected Color getHeaderBackground() {
   Color c = UIManager.getColor("SimpleInternalFrame.activeTitleBackground");
   if (c != null) return c;
   //        if (LookUtils.IS_LAF_WINDOWS_XP_ENABLED)
   //            c = UIManager.getColor("InternalFrame.activeTitleGradient");
   return c != null ? c : UIManager.getColor("InternalFrame.activeTitleBackground");
 }
示例#28
0
 /** reset the renderer */
 protected void reset() {
   setBackground(UIManager.getColor("Table.background"));
   setForeground(UIManager.getColor("Table.foreground"));
   setBorder(null);
   setIcon(null);
   setToolTipText(null);
 }
  /** @param args the command line arguments */
  public static void main(String args[]) {
    /* 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
     */
    try {
      for (javax.swing.UIManager.LookAndFeelInfo info :
          javax.swing.UIManager.getInstalledLookAndFeels()) {
        if ("Nimbus".equals(info.getName())) {
          javax.swing.UIManager.setLookAndFeel(info.getClassName());
          break;
        }
      }
    } catch (ClassNotFoundException
        | InstantiationException
        | IllegalAccessException
        | javax.swing.UnsupportedLookAndFeelException ex) {
      java.util.logging.Logger.getLogger(DatosGasolinera.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    }
    // </editor-fold>

    /* Create and display the form */
    java.awt.EventQueue.invokeLater(
        new Runnable() {
          @Override
          public void run() {
            new DatosGasolinera("root", "manager").setVisible(true);
          }
        });
  }
示例#30
0
  public static void main(String[] args) throws Exception {
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e) {
      e.printStackTrace();
    }

    UIManager.put("PopupMenuUI", "DropShadow.CustomPopupMenuUI");

    JFrame frame = new JFrame(DropShadowDemo.class.getSimpleName());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JMenuBar mb = new JMenuBar();
    frame.setJMenuBar(mb);
    JMenu menu = new JMenu("File");
    mb.add(menu);
    menu.add(new JMenuItem("Open"));
    menu.add(new JMenuItem("Save"));
    menu.add(new JMenuItem("Close"));
    menu.add(new JMenuItem("Exit"));
    menu = new JMenu("Edit");
    mb.add(menu);
    menu.add(new JMenuItem("Cut"));
    menu.add(new JMenuItem("Copy"));
    menu.add(new JMenuItem("Paste"));
    frame.getContentPane().setLayout(new BorderLayout());
    frame.getContentPane().add("North", new JButton("Button"));
    frame.getContentPane().add("Center", new JLabel("a label"));
    frame.getContentPane().add("South", new JCheckBox("checkbox"));
    frame.pack();
    frame.setSize(200, 150);
    frame.setLocationRelativeTo(null);
    frame.show();
  }