Example #1
0
    public HttpClientFrame() {
      client = new HttpClient(new MultiThreadedHttpConnectionManager());
      client.getHttpConnectionManager().getParams().setConnectionTimeout(30000);

      JPanel panInput = new JPanel(new FlowLayout());

      String[] aURLs = {
        "http://www.apache.org/",
        "http://www.google.com/",
        "http://www.opensource.org/",
        "http://www.anybrowser.org/",
        "http://jakarta.apache.org/",
        "http://www.w3.org/"
      };

      final JButton btnGET = new JButton("GET");
      btnGET.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
              String url = (String) cmbURL.getSelectedItem();
              if (url != null && url.length() > 0) {
                loadPage(url);
              }
            }
          });

      cmbURL = new JComboBox(aURLs);
      cmbURL.setToolTipText("Enter a URL");
      cmbURL.setEditable(true);
      cmbURL.setSelectedIndex(0);

      JLabel lblURL = new JLabel("URL:");

      panInput.add(lblURL);
      panInput.add(cmbURL);
      panInput.add(btnGET);

      taTextResponse = new JTextArea();
      taTextResponse.setEditable(false);
      taTextResponse.setCaretPosition(0);

      htmlPane = new JEditorPane();
      htmlPane.setContentType("text/html");
      htmlPane.setEditable(false);

      JSplitPane splitResponsePane =
          new JSplitPane(
              JSplitPane.HORIZONTAL_SPLIT,
              new JScrollPane(taTextResponse),
              new JScrollPane(htmlPane));
      splitResponsePane.setOneTouchExpandable(false);
      splitResponsePane.setDividerLocation(350);
      // it would be better to set resizeWeight, but this method does
      // not exist in JRE 1.2.2
      //            splitResponsePane.setResizeWeight(0.5);

      this.getContentPane().setLayout(new BorderLayout());
      this.getContentPane().add(panInput, BorderLayout.NORTH);
      this.getContentPane().add(splitResponsePane, BorderLayout.CENTER);
    }
Example #2
0
  public ActionFrame() {
    setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);

    buttonPanel = new JPanel();

    // define actions
    Action yellowAction = new ColorAction("Yellow", new ImagIcon("yellow-ball.gif"), Color.YELLOW);
    Action blueAction = new ColorAction("Blue", new ImageIcon("blue-ball.gif"), Color.BLUE);
    Action redAction = new ColorAction("Red", new ImageIcon("red-ball.gif"), Color.RED);

    // add buttons for these actions
    buttonPanel.add(new JButton(yellowAction));
    buttonPanel.add(new JButton(blueAction));
    buttonPanel.add(new JButton(recAction));

    // add panel to frame
    add(buttonPanel);

    // associate the Y, B, and R keys with names
    InputMap imap = buttonPanel.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    imap.put(KeyStroke.getKeyStroke("ctrl Y"), "panel.yellow");
    imap.put(KeyStroke.getKeyStroke("Ctrl B"), "panel.blue");
    imap.put(KeyStroke.getKeyStroke("ctrl R"), "panel.red");

    // associate the names with actions
    ActionMap amap = buttonPanel.getActionMap();
    amap.put("panel.yellow", yellowAction);
    amap.put("panel.blue", blueAction);
    amap.put("panel.red", redAction);
  }
  private Component createTabDisabled() {
    JPanel panel = new JPanel(new MigLayout("fill, wrap 1"));

    final JTextField textField = new JTextField();
    final JCheckBox checkBox = new JCheckBox("Enabled");
    checkBox.setSelected(true);
    panel.add(checkBox);
    checkBox.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent actionEvent) {
            textField.setEnabled(checkBox.isSelected());
          }
        });

    panel.add(textField);
    textField.setColumns(15);

    on(new JTextFieldDocumentChangedTrigger(textField)) //
        .read(new JTextFieldTextProvider(textField)) //
        .check(new StringNotEmptyRule()) //
        .handleWith(new IconBooleanFeedback(textField, "Cannot be empty")) //
        .trigger();

    return panel;
  }
  private JPanel createButtonPanel() {
    JPanel parentPanel = new JPanel(new BorderLayout());
    parentPanel.add(new JSeparator(SwingConstants.HORIZONTAL), BorderLayout.NORTH);

    JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.TRAILING));

    JButton cancelButton = new JButton("Cancel");
    buttonPanel.add(cancelButton);

    cancelButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            dispose();
          }
        });

    JButton createButton = new JButton("Create Thematic Map");
    buttonPanel.add(createButton);

    createButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            generateThematicMap();
          }
        });

    parentPanel.add(buttonPanel, BorderLayout.CENTER);
    return parentPanel;
  }
  public UnitListInternalFrame(String Title, Vector<Unit> units, UnitChangeListener ucl) {
    super(Title, true, true, true, true);

    m_UnitListPanel = new UnitListPanel(units);
    m_UnitListPanel.addUnitChangeListener(ucl);

    getContentPane().setLayout(new BorderLayout());

    // m_UnitListPanel.setFocusable(false);
    getContentPane().add(m_UnitListPanel, BorderLayout.CENTER);

    m_ButtonPanel.setBorder(BorderFactory.createEtchedBorder());
    m_ButtonPanel.setLayout(new BoxLayout(m_ButtonPanel, BoxLayout.X_AXIS));

    m_NewButton.setAlignmentY(Component.CENTER_ALIGNMENT);
    m_NewButton.setActionCommand("New");
    m_NewButton.addActionListener(this);

    m_RemoveButton.setAlignmentY(Component.CENTER_ALIGNMENT);
    m_RemoveButton.setActionCommand("Remove");
    m_RemoveButton.addActionListener(this);

    m_EditButton.setAlignmentY(Component.CENTER_ALIGNMENT);
    m_EditButton.setActionCommand("Edit");
    m_EditButton.addActionListener(this);

    m_ButtonPanel.add(m_NewButton);
    m_ButtonPanel.add(m_EditButton);
    m_ButtonPanel.add(Box.createHorizontalBox());
    m_ButtonPanel.add(m_RemoveButton);
    m_ButtonPanel.add(Box.createHorizontalGlue());

    getContentPane().add(m_ButtonPanel, BorderLayout.SOUTH);
  }
Example #6
0
    private JPanel makeAttributesPanel() {
      JPanel panel = new JPanel(new GridLayout(1, 2, 8, 8));
      panel.add(this.makePathAttributesPanel());
      panel.add(this.makeInteriorAttributesPanel());

      return panel;
    }
Example #7
0
  // constructor for duplicate boards
  // uses the solution board to generate proper hints
  public Puzzle(Board board, Board solution) {
    this.board = new Board(board);
    Board solutionBoard = solution;

    setLayout(new BorderLayout());

    // Plug in the top panel which will sit at the top
    this.topPanel = new PuzzleTop(solutionBoard, this.board, false);
    add(this.topPanel, BorderLayout.NORTH);

    // Add the sidebar to the second row
    this.sidebarPanel = new PuzzleSidebar(solutionBoard, this.board, false);
    add(this.sidebarPanel, BorderLayout.WEST);

    // Add the board panel to the second row
    this.boardPanel = new PuzzleBoard(this.board);
    boardLayout.add(this.boardPanel, BorderLayout.CENTER);

    // vertical drag
    PuzzleDragVertical verticalDragPanel = new PuzzleDragVertical(this.board, this);
    add(verticalDragPanel, BorderLayout.EAST);

    // horizontal drag
    PuzzleDragHorizontal horizontalDragPanel = new PuzzleDragHorizontal(this.board, this);
    boardLayout.add(horizontalDragPanel, BorderLayout.SOUTH);

    add(boardLayout, BorderLayout.CENTER);
  }
Example #8
0
  /**
   * Adds a new tab to the download dialog in JOSM.
   *
   * <p>This method is, for all intents and purposes, the constructor for this class.
   */
  @Override
  public void addGui(final DownloadDialog gui) {
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.add(buildSearchPanel(), BorderLayout.NORTH);

    DefaultListSelectionModel selectionModel = new DefaultListSelectionModel();
    model = new NamedResultTableModel(selectionModel);
    columnmodel = new NamedResultTableColumnModel();
    tblSearchResults = new JTable(model, columnmodel);
    tblSearchResults.setSelectionModel(selectionModel);
    JScrollPane scrollPane = new JScrollPane(tblSearchResults);
    scrollPane.setPreferredSize(new Dimension(200, 200));
    panel.add(scrollPane, BorderLayout.CENTER);

    gui.addDownloadAreaSelector(panel, tr("Areas around places"));

    scrollPane.setPreferredSize(scrollPane.getPreferredSize());
    tblSearchResults.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    tblSearchResults.getSelectionModel().addListSelectionListener(new ListSelectionHandler());
    tblSearchResults.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() > 1) {
              SearchResult sr = model.getSelectedSearchResult();
              if (sr == null) return;
              parent.startDownload(sr.getDownloadArea());
            }
          }
        });
    parent = gui;
  }
  private JComponent createSettingsPanel() {
    JPanel result = new JPanel(new FlowLayout(FlowLayout.RIGHT, 3, 0));
    result.add(new JLabel(ApplicationBundle.message("label.font.size")));
    myFontSizeSlider = new JSlider(JSlider.HORIZONTAL, 0, FontSize.values().length - 1, 3);
    myFontSizeSlider.setMinorTickSpacing(1);
    myFontSizeSlider.setPaintTicks(true);
    myFontSizeSlider.setPaintTrack(true);
    myFontSizeSlider.setSnapToTicks(true);
    UIUtil.setSliderIsFilled(myFontSizeSlider, true);
    result.add(myFontSizeSlider);
    result.setBorder(BorderFactory.createLineBorder(UIUtil.getBorderColor(), 1));

    myFontSizeSlider.addChangeListener(
        new ChangeListener() {
          @Override
          public void stateChanged(ChangeEvent e) {
            if (myIgnoreFontSizeSliderChange) {
              return;
            }
            EditorColorsManager colorsManager = EditorColorsManager.getInstance();
            EditorColorsScheme scheme = colorsManager.getGlobalScheme();
            scheme.setQuickDocFontSize(FontSize.values()[myFontSizeSlider.getValue()]);
            applyFontSize();
          }
        });

    String tooltipText = ApplicationBundle.message("quickdoc.tooltip.font.size.by.wheel");
    result.setToolTipText(tooltipText);
    myFontSizeSlider.setToolTipText(tooltipText);
    result.setVisible(false);
    result.setOpaque(true);
    myFontSizeSlider.setOpaque(true);
    return result;
  }
  public MyGUIProgram() {
    super("Swing app");
    setSize(400, 300);
    setResizable(true);

    fileLocationField.setPreferredSize(new Dimension(150, 20));
    p.add(fileLocationField);
    p.add(fileLocationLabel);

    phoneNumberField.setPreferredSize(new Dimension(150, 20));
    p.add(phoneNumberField);
    p.add(phoneNumberLabel);

    operationField.setPreferredSize(new Dimension(150, 20));
    p.add(operationField);
    p.add(operationLabel);

    b.addActionListener(new MyActionListner(this));
    p.add(b);

    output.setEditable(false);
    p.add(output);

    add(p);

    setVisible(true);
  }
Example #11
0
  /**
   * The constructor for the SaveDialog class
   *
   * @param parent The LevelEditor class
   */
  public SaveDialog(LevelEditor parent) {
    super();
    le = parent;

    setTitle("SaveDialog");
    setSize(DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT);
    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    setLocationRelativeTo(null);
    setResizable(false);

    textField = new JTextField(10);

    String msgString1 = "Please enter filename:";
    JLabel label = new JLabel(msgString1);
    JButton saveButton = new JButton(btnString1);
    saveButton.setActionCommand(btnString1);
    saveButton.addActionListener(this);
    JButton cancelButton = new JButton(btnString2);
    cancelButton.setActionCommand(btnString2);
    cancelButton.addActionListener(this);
    JPanel text = new JPanel();
    text.setLayout(new BoxLayout(text, BoxLayout.Y_AXIS));
    text.setSize(200, 40);
    text.add(label);
    text.add(textField);
    JPanel buttons = new JPanel();
    buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS));
    buttons.add(saveButton);
    buttons.add(cancelButton);
    add(text);
    add(buttons);
    setVisible(true);
  }
Example #12
0
  public SignUpPanel() {
    RegisterButton = new JButton("Register"); // initializing two button references

    UsernameField = new JTextField(15);
    PasswordField = new JPasswordField(15);
    PasswordField1 = new JPasswordField(15);

    JLabel UsernameLabel = new JLabel("Username: "******"Password: "******"Re-enter Password");

    JPanel UsernamePanel = new JPanel();
    JPanel PasswordPanel = new JPanel();
    JPanel PasswordPanel1 = new JPanel();

    UsernamePanel.add(UsernameLabel);
    UsernamePanel.add(UsernameField);
    PasswordPanel.add(PasswordLabel);
    PasswordPanel.add(PasswordField);
    PasswordPanel1.add(PasswordLabel1);
    PasswordPanel1.add(PasswordField1);

    add(UsernamePanel);
    add(PasswordPanel);
    add(PasswordPanel1);

    add(RegisterButton); // add the two buttons on to this panel
    RegisterButton.addActionListener(this); // event listener registration
  }
Example #13
0
 public DialogView(JFrame parent, String item, int position, String property) {
   super(parent, "Legend", true);
   this.addWindowListener(new CloseHandler());
   itemType = item;
   itemPosition = position;
   detailProperty = property;
   String message = "Which " + item + " would you like to replace?";
   messagePane.add(new JLabel(message));
   getContentPane().add(messagePane);
   buttonPane.add(buttonLeft, BorderLayout.WEST);
   buttonPane.add(buttonRight, BorderLayout.EAST);
   buttonLeft.addActionListener(this);
   buttonRight.addActionListener(this);
   getContentPane().add(buttonPane, BorderLayout.SOUTH);
   setDefaultCloseOperation(DISPOSE_ON_CLOSE);
   pack();
   if (parent != null) {
     Dimension parentSize = parent.getSize();
     Dimension dialogSize = this.getSize();
     Point p = parent.getLocation();
     setLocation(
         p.x + parentSize.width / 2 - dialogSize.width / 2,
         p.y + parentSize.height / 2 - dialogSize.height / 2);
   }
   setTitle("Legend");
   setVisible(true);
 }
Example #14
0
  public TransactionPanel() {
    setLayout(new GridLayout(2, 1));
    setBorder(BorderFactory.createMatteBorder(10, 10, 10, 10, DARK_CHAMPAGNE));

    listModel.removeAllElements();
    readTransactions();
    receiptList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    titleLabel.setVerticalAlignment(SwingConstants.TOP);
    titleLabel.setFont(new Font(Font.SERIF, Font.BOLD, 24));
    listLabel.setVerticalAlignment(SwingConstants.BOTTOM);
    listLabel.setFont(new Font(Font.SERIF, Font.ITALIC, 18));

    buttonPanel.setBackground(DARK_CHAMPAGNE);
    buttonPanel.add(new MenuButton("Load", "Load", this));
    //		buttonPanel.add(new MenuButton("Delete","Delete",this));
    //		buttonPanel.add(new MenuButton("Void", "Void", this));
    //		buttonPanel.add(new MenuButton("Delete All","Delete All",this));
    buttonPanel.add(new MenuButton("Print", "Print", this));
    Tools.addBlankSpace(buttonPanel, 2);

    upperPanel.setBackground(DARK_CHAMPAGNE);
    upperPanel.add(titleLabel);
    upperPanel.add(buttonPanel);
    upperPanel.add(listLabel);

    add(upperPanel);
    add(
        new JScrollPane(
            receiptList,
            ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS));
  }
Example #15
0
 /**
  * This method initializes AggButtonPanel
  *
  * @return javax.swing.JPanel
  */
 private JPanel getAggButtonPanel() {
   if (AggButtonPanel == null) {
     GridBagConstraints gridBagConstraints21 = new GridBagConstraints();
     gridBagConstraints21.gridx = 0;
     gridBagConstraints21.gridy = 4;
     GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
     gridBagConstraints11.gridx = 0;
     gridBagConstraints11.gridy = 3;
     GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
     gridBagConstraints2.gridx = 0;
     gridBagConstraints2.gridy = 2;
     GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
     gridBagConstraints1.gridx = 0;
     gridBagConstraints1.gridy = 1;
     GridBagConstraints gridBagConstraints = new GridBagConstraints();
     gridBagConstraints.gridx = 0;
     gridBagConstraints.gridy = 0;
     AggButtonPanel = new JPanel();
     AggButtonPanel.setLayout(new GridBagLayout());
     AggButtonPanel.add(getAggAdd(), gridBagConstraints);
     AggButtonPanel.add(getAggRemove(), gridBagConstraints1);
     AggButtonPanel.add(getAggEdit(), gridBagConstraints2);
     AggButtonPanel.add(getDoneButton(), gridBagConstraints11);
     AggButtonPanel.add(getAbort(), gridBagConstraints21);
   }
   return AggButtonPanel;
 }
  protected JComponent createBeepPanel() {
    JPanel beepPanel = new JPanel();

    final JFormattedTextField beepFreq = new JFormattedTextField(Base.getLocalFormat());
    final JFormattedTextField beepDur = new JFormattedTextField(Base.getLocalFormat());
    final JButton beepButton = new JButton("Beep Beep!");

    beepFreq.setColumns(5);
    beepDur.setColumns(5);

    final int EFFECT_DO_IMMEDATELY = 0; // /
    beepButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent arg0) {
            Base.logger.severe("running sendBeep");
            machine.runCommand(
                new SendBeep(
                    ((Number) beepFreq.getValue()).intValue(),
                    ((Number) beepDur.getValue()).intValue(),
                    EFFECT_DO_IMMEDATELY));
          }
        });

    beepPanel.add(new JLabel("Frequency"), "split");
    beepPanel.add(beepFreq, "growy");
    beepPanel.add(new JLabel("Duration"), "gap unrel");
    beepPanel.add(beepDur, "growx");
    beepPanel.add(beepButton, "gap unrel");
    return beepPanel;
  }
Example #17
0
  /**
   * Creates body of the dialog. You can redefine getDialogTitle(), getDescription(), getInputPane()
   * methods to customize this body.
   */
  protected final JPanel body() {
    final JPanel pane = new JPanel();
    pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS));
    final JEditorPane descPane =
        new JEditorPane(
            Tools.MIME_TYPE_TEXT_HTML,
            "<span style='font:bold italic;font-family:Dialog; font-size:"
                + Tools.getConfigData().scaled(14)
                + ";'>"
                + getDialogTitle()
                + "</span><br>"
                + "<span style='font-family:Dialog; font-size:"
                + Tools.getConfigData().scaled(12)
                + ";'>"
                + getDescription()
                + "</span>");
    descPane.setSize(300, Integer.MAX_VALUE);

    descPane.setBackground(Tools.getDefaultColor("ConfigDialog.Background"));
    descPane.setEditable(false);
    final JScrollPane descSP = new JScrollPane(descPane);
    descSP.setBorder(null);
    descSP.setAlignmentX(Component.LEFT_ALIGNMENT);
    descSP.setMinimumSize(new Dimension(0, 50));
    pane.add(descSP);
    final JComponent inputPane = getInputPane();
    if (inputPane != null) {
      inputPane.setMinimumSize(new Dimension(Short.MAX_VALUE, INPUT_PANE_HEIGHT));
      inputPane.setBackground(Tools.getDefaultColor("ConfigDialog.Background"));
      inputPane.setAlignmentX(Component.LEFT_ALIGNMENT);
      pane.add(inputPane);
    }
    pane.setBackground(Tools.getDefaultColor("ConfigDialog.Background.Light"));
    return pane;
  }
  /**
   * The activation panel contains functions related to pausing, starting, and powering the steppers
   * up or down.
   */
  protected JComponent createActivationPanel() {
    JPanel activationPanel = new JPanel();
    activationPanel.setBorder(BorderFactory.createTitledBorder("Stepper Motor Controls"));
    activationPanel.setLayout(new BoxLayout(activationPanel, BoxLayout.LINE_AXIS));

    // / Enable/disable steppers.
    JButton enableButton = new JButton("Enable");
    enableButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            machine.runCommand(new replicatorg.drivers.commands.EnableDrives());
          }
        });
    activationPanel.add(enableButton);

    JButton disableButton = new JButton("Disable");
    disableButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            machine.runCommand(new replicatorg.drivers.commands.DisableDrives());
          }
        });
    activationPanel.add(disableButton);

    activationPanel.add(Box.createHorizontalGlue());

    return activationPanel;
  }
Example #19
0
  private void initView() {

    // R�cup�ration du sujet pirelli

    setLayout(new BorderLayout(0, 0));

    JPanel panel = new JPanel();
    add(panel, BorderLayout.NORTH);
    panel.setLayout(new BorderLayout(0, 0));

    // affichage du sujet
    JLabel label = new JLabel(model.getTitle());
    panel.add(label, BorderLayout.WEST);

    numberLabel = new JLabel(this.model.getComments().size() + " comments");
    panel.add(numberLabel, BorderLayout.EAST);

    JScrollPane scrollPane = new JScrollPane();
    add(scrollPane, BorderLayout.CENTER);

    commentsPanel = new JPanel();
    scrollPane.setViewportView(commentsPanel);
    commentsPanel.setLayout(new BoxLayout(commentsPanel, BoxLayout.Y_AXIS));

    // affichage des commentaires
    List<Comment> comments = model.getComments();
    for (Comment comment : comments) {
      CommentView commentView = createCommentView(comment);
      commentsPanel.add(commentView);
    }
  }
  /**
   * Creates the geomerty input tabbed page
   *
   * @param tabbedPane The TabbedPane to add the tab to
   */
  private void getGeometryInput(JTabbedPane tabbedPane) {
    JPanel geometryInput = new JPanel(new GridBagLayout());

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridwidth = REMAINDER;
    gbc.fill = BOTH;
    gbc.anchor = NORTHWEST;
    gbc.weighty = 1.0;

    chainwheelGeometryInput.addContentChangeListener(this);
    geometryInput.add(chainwheelGeometryInput, gbc);

    sprocketGeometryInput.addContentChangeListener(this);
    geometryInput.add(sprocketGeometryInput, gbc);

    generalGeometryInput.addContentChangeListener(this);
    geometryInput.add(generalGeometryInput, gbc);

    driveTrainDrawing.addContentChangeListener(this);
    driveTrainOutput.addContentChangeListener(this);

    tabbedPane.addTab(
        Messages.getString("GeometryDetails"),
        null,
        geometryInput,
        Messages.getString("GeometryDetailsTip"));
  }
  private JPanel createBrowsePanel() {
    JPanel browsePanel = new JPanel(new BorderLayout());
    final JTextField directoryText = new JTextField();
    directoryText.setEditable(false);
    browsePanel.add(directoryText, BorderLayout.CENTER);
    JButton browseButton = new JButton("Browse...");
    browsePanel.add(browseButton, BorderLayout.EAST);

    browseButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            JFileChooser chooser = new JFileChooser();
            chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
            int retval = chooser.showSaveDialog(CreateThematicMapDialog.this);
            if (retval == JFileChooser.APPROVE_OPTION) {
              File selectedFile = chooser.getSelectedFile();
              directoryText.setText(selectedFile.getPath());
              evaluateFile = selectedFile;
            }
          }
        });

    Collections.<Component>addAll(evaluateEnablement, directoryText, browseButton);

    return browsePanel;
  }
Example #22
0
  /** Description of the Method */
  public void init() {
    // super.init();
    size = new Dimension(570, 570);
    contentPane = (JPanel) this.getContentPane();
    contentPane.setLayout(borderLayout1);

    Dimension d = messagePanel.getSize();
    d.height += 20;
    messagePanel.setPreferredSize(d);
    contentPane.add(messagePanel, BorderLayout.SOUTH);

    contentPane.setOpaque(true);
    userPanel.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(2, 2, 2, 2);

    messagePanel.setLayout(borderLayout5);
    contentPane.setOpaque(true);
    contentPane.setBackground(Color.white);
    this.setSize(size);

    messagePanel.add(labelMessage, BorderLayout.NORTH);
    // Logg.logg("MhClient: Före XttTree-skapande", 6);
    this.mhTable = new MhTable(root, false, this.labelMessage);
    // Logg.logg("MhClient: mhTable-skapande klart", 6);
    this.contentPane.add(this.mhTable.splitPane, BorderLayout.CENTER);
  }
Example #23
0
  private void setupDirectorySelection(JPanel panel) {
    JLabel lblScriptsDirectory = new JLabel(OStrings.getString("SCW_SCRIPTS_FOLDER"));
    panel.add(lblScriptsDirectory);

    m_txtScriptsDir = new JTextField();
    panel.add(m_txtScriptsDir);
    if (m_scriptsDirectory != null) {
      m_txtScriptsDir.setText(m_scriptsDirectory.getPath());
    }

    m_txtScriptsDir.setColumns(40);
    m_txtScriptsDir.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent evt) {
            directoryTextFieldActionPerformed(evt);
          }
        });

    JButton btnBrowse = new JButton();
    Mnemonics.setLocalizedText(btnBrowse, OStrings.getString("SCW_SCRIPTS_FOLDER_CHOOSE"));
    btnBrowse.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent evt) {
            directoryChooserButtonActionPerformed(evt);
          }
        });

    panel.add(btnBrowse);
  }
  /** Arg Constructor */
  public TicTacToeFrame() {

    // Creates a panel for grid layout
    // http://www.java-tips.org/java-se-tips-100019/15-javax-swing/1751-how-to-make-split-pane-using-swing8.html
    JPanel gameBoardPanel = new JPanel(new GridLayout(3, 3, 0, 0)); // panel 1
    JPanel gameStatusPanel = new JPanel(); // panel 2

    // JLabel gameStatusLabel = new JLabel("Area 2");
    // gameBoardPanel.add(j1);
    gameStatusPanel.add(gameStatusLabel2);
    gameStatusPanel.add(gameStatusLabel3);
    gameStatusPanel.add(gameStatusLabel);
    JSplitPane splitPane =
        new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, gameBoardPanel, gameStatusPanel);
    splitPane.setResizeWeight(0.9);
    splitPane.setOneTouchExpandable(true);
    getContentPane().add(splitPane);

    // Adds 9 cells to grid layout
    for (int i = 0; i < 3; i++) {
      for (int k = 0; k < 3; k++) {
        gameBoardPanel.add(cells[i][k] = new Cell());
      }
    }
  }
  /** Create the frame. */
  public DeleteBlank() {
    setTitle("\u53BB\u6389\u5B57\u7B26\u4E32\u4E2D\u7684\u6240\u6709\u7A7A\u683C");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 386, 128);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    JLabel label = new JLabel("\u8F93\u5165\u5B57\u7B26\u4E32\uFF1A");
    label.setBounds(21, 10, 75, 15);
    contentPane.add(label);

    JButton button = new JButton("\u53BB\u9664\u7A7A\u683C");
    button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            do_button_actionPerformed(e);
          }
        });
    button.setBounds(10, 49, 82, 23);
    contentPane.add(button);

    textField = new JTextField();
    textField.setBounds(102, 2, 258, 30);
    contentPane.add(textField);
    textField.setColumns(10);

    resultField = new JTextField();
    resultField.setBounds(102, 45, 258, 30);
    contentPane.add(resultField);
    resultField.setColumns(10);
  }
Example #26
0
  public static void main(String[] args) {
    final Browser browser = new Browser();
    BrowserView browserView = new BrowserView(browser);

    final JTextField addressBar = new JTextField("http://www.teamdev.com/jxbrowser");
    addressBar.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            browser.loadURL(addressBar.getText());
          }
        });

    JPanel addressPane = new JPanel(new BorderLayout());
    addressPane.add(new JLabel(" URL: "), BorderLayout.WEST);
    addressPane.add(addressBar, BorderLayout.CENTER);

    JFrame frame = new JFrame("JxBrowser - Hello World");
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    frame.add(addressPane, BorderLayout.NORTH);
    frame.add(browserView, BorderLayout.CENTER);
    frame.setSize(800, 500);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);

    browser.loadURL(addressBar.getText());
  }
    public ProjectsDetailedView() {
      super(pageName);

      JPanel viewContainer = (JPanel) ViewUtil.clear(this.getContentPanel());
      viewContainer.setLayout(new BorderLayout());

      JPanel infoContainer = ViewUtil.getClearPanel();
      ViewUtil.applyVerticalBoxLayout(infoContainer);

      viewContainer.add(ViewUtil.getClearBorderlessScrollPane(infoContainer), BorderLayout.CENTER);

      CollapsiblePanes panes = new CollapsiblePanes();
      panes.setOpaque(false);
      infoContainer.add(panes);

      infoPanel = new CollapsiblePane();
      infoPanel.setStyle(CollapsiblePane.TREE_STYLE);
      infoPanel.setCollapsible(false);
      panes.add(infoPanel);
      panes.addExpansion();

      content = new JPanel();
      content.setLayout(new BorderLayout());
      infoPanel.setLayout(new BorderLayout());
      infoPanel.add(content, BorderLayout.CENTER);

      details = ViewUtil.getClearPanel();

      content.add(details);
    }
  protected void initComponents() {
    activation = new JComboBox(new String[] {KEY_EQUIVALENT, TAB_TRIGGER});

    final CardLayout cardLayout = new CardLayout();
    activationSpec = new JPanel();
    activationSpec.setLayout(cardLayout);

    keyEquivalent = new JTextField();
    tabTrigger = new JTextField();
    name = new JTextField();

    activationSpec.add(keyEquivalent, KEY_EQUIVALENT);
    activationSpec.add(tabTrigger, TAB_TRIGGER);

    activation.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent itemEvent) {
            if (itemEvent.getStateChange() != ItemEvent.SELECTED) return;

            cardLayout.show(activationSpec, (String) itemEvent.getItem());
          }
        });

    scope = new JTextField();
  }
  private Component createTabSplitPane() {
    JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);

    JPanel panel = new JPanel(new MigLayout("fill"));
    splitPane.setTopComponent(panel);
    JTextField textField = new JTextField();
    textField.setColumns(15);
    panel.add(textField);

    on(new JTextFieldDocumentChangedTrigger(textField)) //
        .read(new JTextFieldTextProvider(textField)) //
        .check(new StringNotEmptyRule()) //
        .handleWith(new IconBooleanFeedback(textField)) //
        .trigger();

    panel = new JPanel(new MigLayout("fill"));
    splitPane.setBottomComponent(panel);
    textField = new JTextField();
    textField.setColumns(15);
    panel.add(textField);

    on(new JTextFieldDocumentChangedTrigger(textField)) //
        .read(new JTextFieldTextProvider(textField)) //
        .check(new StringNotEmptyRule()) //
        .handleWith(new IconBooleanFeedback(textField)) //
        .trigger();

    return splitPane;
  }
Example #30
0
  public About() {
    cl = ClassLoader.getSystemClassLoader();

    // ----------------------------------------CENTER--------------------------------//
    imgAbout = new ImageIcon(cl.getResource("om.png"));

    lblAbout = new JLabel(imgAbout);

    lblAbout.setBounds(0, 0, 450, 263);

    JPanel pnlCenter = new JPanel();
    pnlCenter.setLayout(null);
    pnlCenter.add(lblAbout);

    btnOk = new JButton(new ImageIcon(cl.getResource("ok.png")));
    btnOk.setBounds(390, 215, 40, 30);
    pnlCenter.add(btnOk);
    btnOk.addActionListener(this);

    // -----------------------------------CONTAINER----------------------------------//
    Container c = getContentPane();
    c.setLayout(new BorderLayout());
    c.add(pnlCenter, BorderLayout.CENTER);
    setSize(450, 280);
    setVisible(true);
    setResizable(false);
    setLocation(580, 280);
    // setDefaultCloseOperation(EXIT_ON_CLOSE);

  }