public void show() {
    FloorcJson floorcJson = null;
    try {
      floorcJson = Settings.get();
    } catch (Throwable ignored) {
    }

    HashMap<String, String> auth =
        floorcJson != null ? floorcJson.auth.get(Constants.defaultHost) : null;
    String username = "******";
    if (auth != null) {
      username = auth.get("username");
    }
    usernameInput.setText(username);
    frame = new JFrame();
    frame.getContentPane().add(contentContainer);
    frame.setMinimumSize(new Dimension(650, 500));
    frame.setResizable(false);
    frame.setLocationRelativeTo(null);
    frame.pack();
    contentContainer.setBorder(new EmptyBorder(5, 5, 5, 5));
    frame.setVisible(true);
    String contents =
        "<html><body><p>When you submit an "
            + "issue we will be notified right away. If we have contact information for you<br/> we will respond. You can also "
            + "contact us via [email protected], on IRC in #floobits<br/> "
            + "on Freenode, or via @floobits Twitter. If you run into "
            + "a bug it may help us if you send us your <br/>log. You can find it by going to Help -&gt; Find "
            + "log....     </p></body></html>";

    instructionsLabel.setText(contents);
    instructionsLabel.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, true);
  }
Example #2
0
 public static void main(String[] args) throws Exception {
   JFrame frame = new JFrame("Magic Circle");
   frame.setLocation(550, 150);
   frame.setMinimumSize(new Dimension(600, 400));
   frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
   frame.add(new Frame4());
   frame.pack();
   frame.setVisible(true);
 }
Example #3
0
 public static void main(String[] args) {
   JFrame frame = new JFrame("Exercise01");
   JApplet applet = new Exercise01();
   frame.add(applet);
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.setSize(640, 480);
   frame.setMinimumSize(new Dimension(frame.getWidth(), frame.getHeight()));
   frame.setLocationRelativeTo(null);
   frame.setVisible(true);
 }
Example #4
0
  public MainFrame() {

    JFrame frame = new JFrame("Tanks");
    frame.setLocation(100, 100);
    frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    frame.setContentPane(new MainPanel());
    //        frame.add(new MainPanel());
    frame.setMinimumSize(new Dimension(200, 200));
    frame.setVisible(true);
  }
Example #5
0
  public ShopWindow(Shop shop) {
    this.shop = shop;
    this.frame = new JFrame("Shop");
    frame.setMinimumSize(new Dimension(700, 500));
    frame.setLocation(300, 100);
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

    frame.getContentPane().add(createShopPanel());

    frame.pack();
    frame.setVisible(true);
  }
Example #6
0
  public DemoVisualizeR(Maze maze, RewardFunction ag) {
    frame = new JFrame();
    panel = new Canvas();
    this.ag = ag;
    this.agx = 0;
    this.agy = 0;
    this.maze = maze;

    panel.setMinimumSize(new Dimension(500, 500));
    frame.setMinimumSize(new Dimension(500, 500));
    frame.add(panel);
    frame.setVisible(true);
  }
  public Ui(Timer timer) {
    this.timer = timer;
    Timer.setCALLBACK(
        (i) -> {
          try (PrintWriter printWriter = new PrintWriter(new FileWriter("storage.txt"))) {
            printWriter.println("start" + (System.currentTimeMillis() - (i * 1000)));
          } catch (IOException e) {
            e.printStackTrace();
          }
          timeLabel.setText(String.valueOf(i));
        });

    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    frame.setMinimumSize(new Dimension(300, 100));

    frame.setContentPane(contentPanel);
    contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.LINE_AXIS));

    frame.add(startButton);
    frame.add(pauseButton);
    frame.add(stopButton);
    frame.add(timeLabel);

    startButton.addActionListener(
        (actionEvent) -> {
          Timer.start();
        });

    pauseButton.addActionListener(
        (actionEvent) -> {
          Timer.pause();
          try (PrintWriter printWriter = new PrintWriter(new FileWriter("storage.txt"))) {
            printWriter.println("pause" + timer.curTime);
          } catch (IOException e) {
            e.printStackTrace();
          }
        });

    stopButton.addActionListener(
        (actionEvent) -> {
          Timer.stop();
          try (PrintWriter printWriter = new PrintWriter(new FileWriter("storage.txt"))) {
            printWriter.println("stop" + timer.curTime);
          } catch (IOException e) {
            e.printStackTrace();
          }
        });
  }
 /** Creates the JFrame that will contain everything. */
 protected JFrame createFrame() {
   JFrame retFrame = new JFrame("TreeTable III -- " + path);
   Dimension dimension = new Dimension(600, 400);
   retFrame.setSize(600, 600);
   retFrame.setMinimumSize(dimension);
   retFrame.addWindowListener(
       new WindowAdapter() {
         public void windowClosing(WindowEvent we) {
           frame.dispose();
           if (--ttCount == 0) {
             System.exit(0);
           }
         }
       });
   return retFrame;
 }
Example #9
0
  public static void init_show() {

    frame = new slideshow("slideshow");
    frame.setSize(300, 300);
    frame.setVisible(true);
    // center on screen
    frame.setLocationRelativeTo(null);
    frame.setResizable(false);
    frame.setMinimumSize(frame.getMinimumSize());
    frame.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            frame.dispose();
          }
        });
  }
  public ShapesTemplate(Shape[] shapes) {
    this.shapes = shapes;
    if (shapes == null || shapes.length < 1) {
      this.shapes = new Shape[0];
    }

    JFrame frame = new JFrame("DAY 6, 2D Graphics");
    frame.setLocation(750, 150);
    frame.setMinimumSize(new Dimension(600, 400));
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    frame.getContentPane().add(this);
    frame.pack();
    frame.setVisible(true);

    repaint();
  }
  /**
   * Method which creates a new GUI, and calls helper methods to set up the listeners for all the
   * buttons on the board.
   *
   * @throws IOException
   */
  public void init() throws IOException {
    gui = new GUI(board);
    setCurrentSide(WHITE);
    JFrame f = new JFrame("Fighting Illini Chess");
    f.add(gui.getGUI());
    f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

    // ensures the frame is the minimum size it needs to be
    // in order display the components within it
    f.pack();
    // ensures the minimum size is enforced.
    f.setMinimumSize(f.getSize());
    f.setVisible(true);

    // set up and add button action listeners
    initializeListeners();
    addListeners();
  }
Example #12
0
  public void initUI() {
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
      JPopupMenu.setDefaultLightWeightPopupEnabled(false);
      frame = new JFrame("Project Benelux | 317 | Fullscreen - Resizeable");
      frame.setLayout(new BorderLayout());
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      gamePanel = new JPanel();
      new AutoUpdater().run();
      webclient = false;
      gamePanel.setLayout(new BorderLayout());
      gamePanel.add(this);
      JMenu fileMenu = new JMenu("File");

      String[] mainButtons = new String[] {"-", "Exit", "-"};

      for (String name : mainButtons) {
        JMenuItem menuItem = new JMenuItem(name);
        if (name.equalsIgnoreCase("-")) {
          fileMenu.addSeparator();
        } else {
          menuItem.addActionListener(this);
          fileMenu.add(menuItem);
        }
      }

      JMenuBar menuBar = new JMenuBar();
      JMenuBar jmenubar = new JMenuBar();
      Dimension dimension1 = new Dimension(765 + 16, 503 + 59);
      frame.setMinimumSize(dimension1);
      frame.add(jmenubar);
      menuBar.add(fileMenu);
      frame.getContentPane().add(menuBar, BorderLayout.NORTH);
      frame.getContentPane().add(gamePanel, BorderLayout.CENTER);
      frame.pack();

      frame.setVisible(true); // can see the client
      frame.setResizable(true); // resizeable frame
      init();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  public ActionField() throws Exception {
    battleField = new BattleField();
    tank = new Tank(this, battleField);

    agressor =
        new Agressor(
            Integer.parseInt(position.substring(0, position.indexOf("_"))),
            Integer.parseInt(position.substring(position.lastIndexOf("_") + 1, position.length())),
            Direction.LEFT,
            this,
            battleField);
    bullet = new Bullet(-100, -100, Direction.STOP);
    JFrame frame = new JFrame("BATTLE FIELD, DAY 2");
    frame.setLocation(750, 150);
    frame.setMinimumSize(
        new Dimension(battleField.getBF_WIDTH() + 16, battleField.getBF_HEIGHT() + 39));
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    frame.getContentPane().add(this);
    frame.pack();
    frame.setVisible(true);
  }
  /** Aware-P Epanet frontend constructor. */
  public EpanetUI() {
    initLogger();

    frame = new JFrame();
    frame.setTitle(APP_TITTLE);
    frame.add(root);

    if (!Utilities.isMac()) {
      JMenuBar menuBar = new JMenuBar();

      JMenu fileMenu = new JMenu("File");
      menuBar.add(fileMenu);

      openAction = new JMenuItem("Open");
      saveAction = new JMenuItem("Save");
      runAction = new JMenuItem("Run");

      fileMenu.add(openAction);
      fileMenu.add(openAction);
      fileMenu.add(runAction);

      frame.setJMenuBar(menuBar);
    }

    openAction.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            openEvent();
            network.repaint();
          }
        });

    saveAction.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            saveEvent();
          }
        });

    runAction.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            runSimulation();
          }
        });

    frame.pack();
    frame.setMinimumSize(new Dimension(848, 500));
    frame.setLocationRelativeTo(null);

    clearInterface();

    frame.setVisible(true);

    openINPButton.addActionListener(this);
    runSimulationButton.addActionListener(this);
    logoB.addActionListener(this);
    checkTanks.addActionListener(this);
    checkNodes.addActionListener(this);
    checkPipes.addActionListener(this);
    saveButton.addActionListener(this);
    // runMSXButton.addActionListener(this);
    // saveReport.addActionListener(this);

    frame.addWindowListener(
        new WindowListener() {
          public void windowOpened(WindowEvent e) {}

          public void windowClosing(WindowEvent e) {
            for (Handler handler : log.getHandlers()) {
              handler.flush();
            }
            System.exit(0);
          }

          public void windowClosed(WindowEvent e) {}

          public void windowIconified(WindowEvent e) {}

          public void windowDeiconified(WindowEvent e) {}

          public void windowActivated(WindowEvent e) {}

          public void windowDeactivated(WindowEvent e) {}
        });
  }
Example #15
0
  public SwingUpdaterUI(String oldBuildDesc, String newBuildDesc, InstallOperation operation) {
    myOperation = operation;

    myProcessTitle = new JLabel(" ");
    myProcessProgress = new JProgressBar(0, 100);
    myProcessStatus = new JLabel(" ");

    myCancelButton = new JButton(CANCEL_BUTTON_TITLE);

    myConsole = new JTextArea();
    myConsole.setLineWrap(true);
    myConsole.setWrapStyleWord(true);
    myConsole.setCaretPosition(myConsole.getText().length());
    myConsole.setTabSize(1);
    myConsolePane = new JPanel(new BorderLayout());
    myConsolePane.add(new JScrollPane(myConsole));
    myConsolePane.setBorder(BUTTONS_BORDER);
    myConsolePane.setVisible(false);

    myCancelButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            doCancel();
          }
        });

    myFrame = new JFrame();
    myFrame.setTitle(TITLE);

    myFrame.setLayout(new BorderLayout());
    myFrame.getRootPane().setBorder(FRAME_BORDER);
    myFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);

    myFrame.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent e) {
            doCancel();
          }
        });

    JPanel processPanel = new JPanel();
    processPanel.setLayout(new BoxLayout(processPanel, BoxLayout.Y_AXIS));
    processPanel.add(myProcessTitle);
    processPanel.add(myProcessProgress);
    processPanel.add(myProcessStatus);

    processPanel.add(myConsolePane);
    for (Component each : processPanel.getComponents()) {
      ((JComponent) each).setAlignmentX(Component.LEFT_ALIGNMENT);
    }

    JPanel buttonsPanel = new JPanel();
    buttonsPanel.setBorder(BUTTONS_BORDER);
    buttonsPanel.setLayout(new BoxLayout(buttonsPanel, BoxLayout.X_AXIS));
    buttonsPanel.add(Box.createHorizontalGlue());
    buttonsPanel.add(myCancelButton);

    myProcessTitle.setText("<html>Updating " + oldBuildDesc + " to " + newBuildDesc + "...");

    myFrame.add(processPanel, BorderLayout.CENTER);
    myFrame.add(buttonsPanel, BorderLayout.SOUTH);

    myFrame.setMinimumSize(new Dimension(500, 50));
    myFrame.pack();
    myFrame.setLocationRelativeTo(null);

    myFrame.setVisible(true);

    myQueue.add(
        new UpdateRequest() {
          @Override
          public void perform() {
            doPerform();
          }
        });

    startRequestDispatching();
  }
Example #16
0
  protected void createAndShowGUI() {
    System.setProperty("swing.defaultlaf", UIManager.getSystemLookAndFeelClassName());

    image = DavGatewayTray.loadImage("tray.png");
    image2 = DavGatewayTray.loadImage(AwtGatewayTray.TRAY_ACTIVE_PNG);
    inactiveImage = DavGatewayTray.loadImage(AwtGatewayTray.TRAY_INACTIVE_PNG);

    mainFrame = new JFrame();
    mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    mainFrame.setTitle(BundleMessage.format("UI_DAVMAIL_GATEWAY"));
    mainFrame.setIconImage(image);

    JPanel errorPanel = new JPanel();
    errorPanel.setBorder(BorderFactory.createTitledBorder(BundleMessage.format("UI_LAST_MESSAGE")));
    errorPanel.setLayout(new BoxLayout(errorPanel, BoxLayout.X_AXIS));
    errorArea = new JTextPane();
    errorArea.setEditable(false);
    errorArea.setBackground(mainFrame.getBackground());
    errorLabel = new JLabel();
    errorPanel.add(errorLabel);
    errorPanel.add(errorArea);

    JPanel messagePanel = new JPanel();
    messagePanel.setBorder(BorderFactory.createTitledBorder(BundleMessage.format("UI_LAST_LOG")));
    messagePanel.setLayout(new BoxLayout(messagePanel, BoxLayout.X_AXIS));

    messageArea = new JTextPane();
    messageArea.setText(BundleMessage.format("LOG_STARTING_DAVMAIL"));
    messageArea.setEditable(false);
    messageArea.setBackground(mainFrame.getBackground());
    messagePanel.add(messageArea);

    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
    mainPanel.add(errorPanel);
    mainPanel.add(messagePanel);
    mainFrame.add(mainPanel);

    aboutFrame = new AboutFrame();
    settingsFrame = new SettingsFrame();
    buildMenu();

    mainFrame.setMinimumSize(new Dimension(400, 180));
    mainFrame.pack();
    // workaround MacOSX
    if (mainFrame.getSize().width < 400 || mainFrame.getSize().height < 180) {
      mainFrame.setSize(
          Math.max(mainFrame.getSize().width, 400), Math.max(mainFrame.getSize().height, 180));
    }
    // center frame
    mainFrame.setLocation(
        mainFrame.getToolkit().getScreenSize().width / 2 - mainFrame.getSize().width / 2,
        mainFrame.getToolkit().getScreenSize().height / 2 - mainFrame.getSize().height / 2);
    mainFrame.setVisible(true);

    // display settings frame on first start
    if (Settings.isFirstStart()) {
      settingsFrame.setVisible(true);
      settingsFrame.toFront();
      settingsFrame.requestFocus();
    }
  }
  private void makeFrame(final Editor editor) {
    dialog = new JFrame(title);
    dialog.setMinimumSize(new Dimension(750, 500));
    tabbedPane = new JTabbedPane();

    makeAndShowTab(false, true);

    tabbedPane.addTab("Libraries", null, librariesContributionTab.panel, "Libraries");
    tabbedPane.setMnemonicAt(0, KeyEvent.VK_1);

    tabbedPane.addTab("Modes", null, modesContributionTab.panel, "Modes");
    tabbedPane.setMnemonicAt(1, KeyEvent.VK_2);

    tabbedPane.addTab("Tools", null, toolsContributionTab.panel, "Tools");
    tabbedPane.setMnemonicAt(2, KeyEvent.VK_3);

    tabbedPane.addTab("Examples", null, examplesContributionTab.panel, "Examples");
    tabbedPane.setMnemonicAt(3, KeyEvent.VK_4);

    tabbedPane.addTab("Updates", null, updatesContributionTab.panel, "Updates");
    tabbedPane.setMnemonicAt(4, KeyEvent.VK_5);

    tabbedPane.setUI(new SpacedTabbedPaneUI());
    tabbedPane.setBackground(new Color(0x132638));
    tabbedPane.setOpaque(true);

    for (int i = 0; i < 5; i++) {
      tabbedPane.setToolTipTextAt(i, null);
    }

    makeAndSetTabComponents();

    tabbedPane.addChangeListener(
        new ChangeListener() {

          @Override
          public void stateChanged(ChangeEvent e) {
            for (int i = 0; i < 4; i++) {
              tabLabels[i].setBackground(new Color(0x2d4251));
              tabLabels[i].setForeground(Color.WHITE);
            }
            updateTabPanel.setBackground(new Color(0x2d4251));
            updateTabLabel.setForeground(Color.WHITE);
            int currentIndex = tabbedPane.getSelectedIndex();
            if (currentIndex != 4) {
              tabbedPane
                  .getTabComponentAt(tabbedPane.getSelectedIndex())
                  .setBackground(new Color(0xe0fffd));
              tabbedPane
                  .getTabComponentAt(tabbedPane.getSelectedIndex())
                  .setForeground(Color.BLACK);
            } else {
              updateTabPanel.setBackground(new Color(0xe0fffd));
              updateTabLabel.setForeground(Color.BLACK);
            }
            getActiveTab().contributionListPanel.scrollPane.requestFocusInWindow();
            //        // When the tab is changed update status to the current selected panel
            //        ContributionPanel currentPanel = getActiveTab().contributionListPanel
            //          .getSelectedPanel();
            //        if (currentPanel != null) {
            //          getActiveTab().contributionListPanel.setSelectedPanel(currentPanel);
            //        }
          }
        });

    //    tabbedPane.setSize(450, 400);
    setLayout();

    restartButton = new JButton(Language.text("contrib.restart"));
    restartButton.setVisible(false);
    restartButton.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent arg0) {

            Iterator<Editor> iter = editor.getBase().getEditors().iterator();
            while (iter.hasNext()) {
              Editor ed = iter.next();
              if (ed.getSketch().isModified()) {
                int option =
                    Messages.showYesNoQuestion(
                        editor,
                        title,
                        Language.text("contrib.unsaved_changes"),
                        Language.text("contrib.unsaved_changes.prompt"));

                if (option == JOptionPane.NO_OPTION) return;
                else break;
              }
            }

            // Thanks to http://stackoverflow.com/a/4160543
            StringBuilder cmd = new StringBuilder();
            cmd.append(
                System.getProperty("java.home")
                    + File.separator
                    + "bin"
                    + File.separator
                    + "java ");
            for (String jvmArg : ManagementFactory.getRuntimeMXBean().getInputArguments()) {
              cmd.append(jvmArg + " ");
            }
            cmd.append("-cp ")
                .append(ManagementFactory.getRuntimeMXBean().getClassPath())
                .append(" ");
            cmd.append(Base.class.getName());

            try {
              Runtime.getRuntime().exec(cmd.toString());
              System.exit(0);
            } catch (IOException e) {
              e.printStackTrace();
            }
          }
        });

    Toolkit.setIcon(dialog);
    registerDisposeListeners();

    dialog.pack();
    dialog.setLocationRelativeTo(null);
  }