Exemplo n.º 1
0
  /** Default constructor for the demo. */
  public IconDemoApp() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setTitle("Icon Demo: Please Select an Image");

    // A label for displaying the pictures
    photographLabel.setVerticalTextPosition(JLabel.BOTTOM);
    photographLabel.setHorizontalTextPosition(JLabel.CENTER);
    photographLabel.setHorizontalAlignment(JLabel.CENTER);
    photographLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    // We add two glue components. Later in process() we will add thumbnail buttons
    // to the toolbar inbetween thease glue compoents. This will center the
    // buttons in the toolbar.
    buttonBar.add(Box.createGlue());
    buttonBar.add(Box.createGlue());

    add(buttonBar, BorderLayout.SOUTH);
    add(photographLabel, BorderLayout.CENTER);

    setSize(400, 300);

    // this centers the frame on the screen
    setLocationRelativeTo(null);

    // start the image loading SwingWorker in a background thread
    loadimages.execute();
  }
Exemplo n.º 2
0
  public AboutDialog(View view) {
    super(view, jEdit.getProperty("about.title"), true);

    JPanel content = new JPanel(new BorderLayout());
    content.setBorder(new EmptyBorder(12, 12, 12, 12));
    setContentPane(content);

    content.add(BorderLayout.CENTER, new AboutPanel());

    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
    buttonPanel.setBorder(new EmptyBorder(12, 0, 0, 0));

    buttonPanel.add(Box.createGlue());
    close = new JButton(jEdit.getProperty("common.close"));
    close.addActionListener(new ActionHandler());
    getRootPane().setDefaultButton(close);
    buttonPanel.add(close);
    buttonPanel.add(Box.createGlue());
    content.add(BorderLayout.SOUTH, buttonPanel);

    pack();
    setResizable(false);
    setLocationRelativeTo(view);
    show();
  }
 public ReceiveAddressDialog(JDialog parent) {
   super(parent, "Receive Addresses", Dialog.ModalityType.DOCUMENT_MODAL);
   setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
   tableModel = new AddressTableModel(columnNames, columnClasses);
   table = new AddressTable(tableModel, columnTypes);
   table.setRowSorter(new TableRowSorter<>(tableModel));
   table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
   scrollPane = new JScrollPane(table);
   JPanel tablePane = new JPanel();
   tablePane.setBackground(Color.WHITE);
   tablePane.add(Box.createGlue());
   tablePane.add(scrollPane);
   tablePane.add(Box.createGlue());
   JPanel buttonPane =
       new ButtonPane(
           this,
           10,
           new String[] {"New", "new"},
           new String[] {"Copy", "copy"},
           new String[] {"Edit", "edit"},
           new String[] {"Done", "done"});
   buttonPane.setBackground(Color.white);
   JPanel contentPane = new JPanel();
   contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
   contentPane.setOpaque(true);
   contentPane.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15));
   contentPane.setBackground(Color.WHITE);
   contentPane.add(tablePane);
   contentPane.add(buttonPane);
   setContentPane(contentPane);
 }
Exemplo n.º 4
0
  public void init() {
    makeMenus();
    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BorderLayout(10, 10));
    _controlPanel = new JPanel();
    _controlPanel.setLayout(new BoxLayout(_controlPanel, BoxLayout.PAGE_AXIS));
    _controlPanel.add(Box.createVerticalGlue());
    _controlPanel.add(makeBlockPanels());
    _controlPanel.add(searchDepthPanel(false));

    _maxSpeedBox.addActionListener(
        (ActionEvent e) -> {
          getBoxData();
        });
    _autoRunPanel =
        makeAutoRunPanel(jmri.InstanceManager.getDefault(SignalSpeedMap.class).getInterpretation());

    _controlPanel.add(_autoRunPanel);
    _controlPanel.add(Box.createVerticalStrut(STRUT_SIZE));

    _forward.setSelected(true);
    _stageEStop.setSelected(false);
    _haltStartBox.setSelected(_haltStart);
    _calibrateBox.setSelected(false);
    _rampInterval.setText(Float.toString(_intervalTime / 1000));
    JPanel p = new JPanel();
    p.add(Box.createGlue());
    JButton button = new JButton(Bundle.getMessage("ButtonRunNX"));
    button.addActionListener(
        (ActionEvent e) -> {
          makeAndRunWarrant();
        });
    p.add(button);
    p.add(Box.createHorizontalStrut(2 * STRUT_SIZE));
    button = new JButton(Bundle.getMessage("ButtonCancel"));
    button.addActionListener(
        (ActionEvent e) -> {
          closeFrame();
        });
    p.add(button);
    p.add(Box.createGlue());
    _controlPanel.add(p);

    _controlPanel.add(Box.createVerticalStrut(STRUT_SIZE));
    _controlPanel.add(makeSwitchPanel());

    mainPanel.add(_controlPanel);
    getContentPane().add(mainPanel);
    addWindowListener(
        new java.awt.event.WindowAdapter() {
          @Override
          public void windowClosing(java.awt.event.WindowEvent e) {
            closeFrame();
          }
        });
    setAlwaysOnTop(true);
    pack();
  }
Exemplo n.º 5
0
  public ErrorListDialog(
      Frame frame, String title, String caption, Vector messages, boolean showPluginMgrButton) {
    super(frame, title, true);

    JPanel content = new JPanel(new BorderLayout(12, 12));
    content.setBorder(new EmptyBorder(12, 12, 12, 12));
    setContentPane(content);

    Box iconBox = new Box(BoxLayout.Y_AXIS);
    iconBox.add(new JLabel(UIManager.getIcon("OptionPane.errorIcon")));
    iconBox.add(Box.createGlue());
    content.add(BorderLayout.WEST, iconBox);

    JPanel centerPanel = new JPanel(new BorderLayout());

    JLabel label = new JLabel(caption);
    label.setBorder(new EmptyBorder(0, 0, 6, 0));
    centerPanel.add(BorderLayout.NORTH, label);

    JList errors = new JList(messages);
    errors.setCellRenderer(new ErrorListCellRenderer());
    errors.setVisibleRowCount(Math.min(messages.size(), 4));

    JScrollPane scrollPane =
        new JScrollPane(
            errors, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    Dimension size = scrollPane.getPreferredSize();
    size.width = Math.min(size.width, 400);
    scrollPane.setPreferredSize(size);

    centerPanel.add(BorderLayout.CENTER, scrollPane);

    content.add(BorderLayout.CENTER, centerPanel);

    Box buttons = new Box(BoxLayout.X_AXIS);
    buttons.add(Box.createGlue());

    ok = new JButton(jEdit.getProperty("common.ok"));
    ok.addActionListener(new ActionHandler());

    if (showPluginMgrButton) {
      pluginMgr = new JButton(jEdit.getProperty("error-list.plugin-manager"));
      pluginMgr.addActionListener(new ActionHandler());
      buttons.add(pluginMgr);
      buttons.add(Box.createHorizontalStrut(6));
    }

    buttons.add(ok);

    buttons.add(Box.createGlue());
    content.add(BorderLayout.SOUTH, buttons);

    getRootPane().setDefaultButton(ok);

    pack();
    setLocationRelativeTo(frame);
    show();
  }
Exemplo n.º 6
0
  /** Initialisation of the UI. */
  private void initUI() {
    JPanel contentPane = (JPanel) getContentPane();
    contentPane.setLayout(new BorderLayout());

    //  Add the menuBar.
    menuBar = new JMenuBar();
    setJMenuBar(menuBar);

    //  Create the File menu.
    fileMenu = new JMenu("File");
    fileMenu.setMnemonic(KeyEvent.VK_F);
    menuBar.add(fileMenu);

    //  Name of the spectrum.
    SplatName splatName = new SplatName(specData);
    TitledBorder splatTitle = BorderFactory.createTitledBorder("Spectrum:");
    splatName.setBorder(splatTitle);

    //  Goes at the top of window.
    add(splatName, BorderLayout.NORTH);

    //  Create the table.
    table = new PrintableJTable();

    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    table.setIntercellSpacing(new Dimension(6, 3));
    table.setRowSelectionAllowed(true);
    table.setColumnSelectionAllowed(false);
    JTableHeader header = table.getTableHeader();
    header.setUpdateTableInRealTime(false);

    JScrollPane scrollPane = new JScrollPane(table);
    TitledBorder scrollTitle = BorderFactory.createTitledBorder("FITS headers:");
    scrollPane.setBorder(scrollTitle);

    // Goes in the center and takes any extra space.
    add(scrollPane, BorderLayout.CENTER);

    // Action bar uses a BoxLayout and is placed at the south.
    JPanel actionBar = new JPanel();
    actionBar.setLayout(new BoxLayout(actionBar, BoxLayout.X_AXIS));
    actionBar.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
    add(actionBar, BorderLayout.SOUTH);

    // Print the headers.
    PrintAction printAction = new PrintAction();
    fileMenu.add(printAction).setMnemonic(KeyEvent.VK_P);

    // Add an action to close the window (appears in File menu and action
    // bar).
    CloseAction closeAction = new CloseAction();
    fileMenu.add(closeAction).setMnemonic(KeyEvent.VK_C);

    JButton closeButton = new JButton(closeAction);
    actionBar.add(Box.createGlue());
    actionBar.add(closeButton);
    actionBar.add(Box.createGlue());
  }
Exemplo n.º 7
0
  // {{{ init() method
  private void init() {
    EditBus.addToBus(this);

    /* Setup panes */
    JPanel content = new JPanel(new BorderLayout(12, 12));
    content.setBorder(new EmptyBorder(12, 12, 12, 12));
    setContentPane(content);

    tabPane = new JTabbedPane();
    tabPane.addTab(jEdit.getProperty("manage-plugins.title"), manager = new ManagePanel(this));
    tabPane.addTab(
        jEdit.getProperty("update-plugins.title"), updater = new InstallPanel(this, true));
    tabPane.addTab(
        jEdit.getProperty("install-plugins.title"), installer = new InstallPanel(this, false));
    EditBus.addToBus(installer);
    content.add(BorderLayout.CENTER, tabPane);

    tabPane.addChangeListener(new ListUpdater());

    /* Create the buttons */
    Box buttons = new Box(BoxLayout.X_AXIS);

    ActionListener al = new ActionHandler();
    mgrOptions = new JButton(jEdit.getProperty("plugin-manager.mgr-options"));
    mgrOptions.addActionListener(al);
    pluginOptions = new JButton(jEdit.getProperty("plugin-manager.plugin-options"));
    pluginOptions.addActionListener(al);
    done = new JButton(jEdit.getProperty("plugin-manager.done"));
    done.addActionListener(al);

    buttons.add(Box.createGlue());
    buttons.add(mgrOptions);
    buttons.add(Box.createHorizontalStrut(6));
    buttons.add(pluginOptions);
    buttons.add(Box.createHorizontalStrut(6));
    buttons.add(done);
    buttons.add(Box.createGlue());

    getRootPane().setDefaultButton(done);

    content.add(BorderLayout.SOUTH, buttons);

    setDefaultCloseOperation(DISPOSE_ON_CLOSE);

    setIconImage(GUIUtilities.getPluginIcon());

    pack();
    GUIUtilities.loadGeometry(this, parent, "plugin-manager");
    GUIUtilities.addSizeSaver(this, parent, "plugin-manager");
    setVisible(true);
  } // }}}
Exemplo n.º 8
0
  /**
   * Create the Swing components that let you change the transparency of the color received from the
   * JColorChooser.
   *
   * @param initialValue the starting alpha value for the color.
   * @return JComponent to adjust the transparency value.
   */
  public JComponent getTransparancyAdjustment(int initialValue) {
    transparency = initialValue;
    // This sets initial transparency effect in preview...
    setPreviewColor(preview.getColor());
    JPanel slidePanel = new JPanel();
    Box slideBox = Box.createHorizontalBox();

    JSlider opaqueSlide =
        new JSlider(JSlider.HORIZONTAL, 0 /* min */, 255 /* max */, initialValue /* initial */);
    java.util.Hashtable<Integer, JLabel> dict = new java.util.Hashtable<Integer, JLabel>();
    String opaqueLabel = i18n.get(ColorTracker.class, "opaque", "opaque");
    String clearLabel = i18n.get(ColorTracker.class, "clear", "clear");
    if (opaqueLabel == null || opaqueLabel.length() == 0) {
      // translations are too long :(
      dict.put(new Integer(126), new JLabel(clearLabel));
    } else {
      dict.put(new Integer(50), new JLabel(clearLabel));
      dict.put(new Integer(200), new JLabel(opaqueLabel));
    }
    // commented because polish translations are too long
    opaqueSlide.setLabelTable(dict);
    opaqueSlide.setPaintLabels(true);
    opaqueSlide.setMajorTickSpacing(50);
    opaqueSlide.setPaintTicks(true);
    opaqueSlide.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent ce) {
            JSlider slider = (JSlider) ce.getSource();
            if (slider.getValueIsAdjusting()) {
              transparency = slider.getValue();
            }
            // This sets transparency in preview...
            setPreviewColor(preview.getColor());
          }
        });

    preview.setPreferredSize(new Dimension(100, slideBox.getHeight()));
    slideBox.add(preview);
    slideBox.add(Box.createGlue());
    slideBox.add(opaqueSlide);
    slideBox.add(Box.createGlue());
    slidePanel.add(slideBox);
    // You know what, it just has to be something, so the
    // UIManager will think it's valid. It will get resized as
    // appropriate when the JDialog gets packed.
    slidePanel.setSize(new Dimension(50, 50));
    return slidePanel;
  }
Exemplo n.º 9
0
  public Newspaper() {
    // setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setTitle("Newspaper");
    getContentPane().setBackground(new Color(251, 236, 175));

    // A label for displaying the pictures
    photographLabel.setVerticalTextPosition(JLabel.BOTTOM);
    photographLabel.setHorizontalTextPosition(JLabel.CENTER);
    photographLabel.setHorizontalAlignment(JLabel.CENTER);
    photographLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    // A label for Displaying the news
    // theLabel.setVerticalTextPosition(JLabel.BOTTOM);
    // theLabel.setHorizontalTextPosition(JLabel.CENTER);
    // theLabel.setHorizontalAlignment(JLabel.CENTER);
    theLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    theLabel.setContentType("text/html");
    theLabel.setEditable(false);

    JScrollPane scrollPane = new JScrollPane(theLabel);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);

    // We add two glue components. Later in process() we will add thumbnail buttons
    // to the toolbar inbetween thease glue compoents. This will center the
    // buttons in the toolbar.
    buttonBar.add(Box.createGlue());
    buttonBar.add(Box.createGlue());
    buttonBar.setBackground(new Color(251, 236, 175));
    // buttonBar.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));

    add(buttonBar, BorderLayout.SOUTH);
    add(photographLabel, BorderLayout.NORTH);
    add(scrollPane, BorderLayout.CENTER);

    Icon header =
        createImageIcon(
            "Resources/Image/newspaper/header.gif", "Blackwood Times : Weekly Newspaper");
    photographLabel.setIcon(header);

    setSize(700, 525);

    // this centers the frame on the screen
    setLocationRelativeTo(null);

    // start the image loading SwingWorker in a background thread
    loadimages.execute();
  }
  public RolloverTitlePane(CollapsiblePane pane) {
    _layout = new CardLayout();

    setLayout(_layout);
    _messageLabel = new JLabel("");
    _messageLabel.setForeground(null);
    _messageLabel.setHorizontalAlignment(SwingConstants.TRAILING);
    add(_messageLabel, "Message");
    _buttonPanel = new NullPanel();
    _buttonPanel.setLayout(new JideBoxLayout(_buttonPanel, JideBoxLayout.X_AXIS));
    _buttonPanel.add(Box.createGlue(), JideBoxLayout.VARY);
    add(_buttonPanel, "Buttons");
    pane.addPropertyChangeListener(
        "rollover",
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent evt) {
            if (Boolean.TRUE.equals(evt.getNewValue())) {
              showButtons();
            } else {
              showMessage();
            }
          }
        });
    JideSwingUtilities.setOpaqueRecursively(this, false);
  }
  /**
   * Adds a JLabel and three JRadioButton instances in a ButtonGroup to the given panel with a
   * GridBagLayout, and returns the buttons in an array.
   */
  private JRadioButton[] addRadioButtonTriplet(String labelText, JPanel panel) {
    GridBagConstraints labelConstraints = new GridBagConstraints();
    labelConstraints.anchor = GridBagConstraints.WEST;
    labelConstraints.insets = new Insets(2, 10, 2, 10);

    GridBagConstraints buttonConstraints = new GridBagConstraints();
    buttonConstraints.insets = labelConstraints.insets;

    GridBagConstraints lastGlueConstraints = new GridBagConstraints();
    lastGlueConstraints.gridwidth = GridBagConstraints.REMAINDER;
    lastGlueConstraints.weightx = 1.0;

    // Create the radio buttons.
    JRadioButton radioButton0 = new JRadioButton();
    JRadioButton radioButton1 = new JRadioButton();
    JRadioButton radioButton2 = new JRadioButton();

    // Put them in a button group.
    ButtonGroup buttonGroup = new ButtonGroup();
    buttonGroup.add(radioButton0);
    buttonGroup.add(radioButton1);
    buttonGroup.add(radioButton2);

    // Add the label and the buttons to the panel.
    panel.add(new JLabel(labelText), labelConstraints);
    panel.add(radioButton0, buttonConstraints);
    panel.add(radioButton1, buttonConstraints);
    panel.add(radioButton2, buttonConstraints);
    panel.add(Box.createGlue(), lastGlueConstraints);

    return new JRadioButton[] {radioButton0, radioButton1, radioButton2};
  }
 /**
  * Create the JMeter tool bar pane containing the running indicator.
  *
  * @return a panel containing the running indicator
  */
 protected Component createToolBar() {
   Box toolPanel = new Box(BoxLayout.X_AXIS);
   toolPanel.add(Box.createRigidArea(new Dimension(10, 15)));
   toolPanel.add(Box.createGlue());
   toolPanel.add(runningIndicator);
   return toolPanel;
 }
  public SelectableSectionTitleBar(String title, Icon contentVisible, Icon contentInvisible) {
    super();

    if (contentVisible != null) {
      this.contentVisible = contentVisible;
    } else {
      this.contentVisible =
          IconManager.getInstance(DetailViewProvider.class, "icons")
              .getIcon(DEFAULT_ICON_CONTENT_VISIBLE); // $NON-NLS-1$
    }
    if (contentInvisible != null) {
      this.contentInVisible = contentInvisible;
    } else {
      this.contentInVisible =
          IconManager.getInstance(DetailViewProvider.class, "icons")
              .getIcon(DEFAULT_ICON_CONTENT_INVISIBLE); // $NON-NLS-1$
    }

    toggleVisibility = new JButton();
    toggleVisibility.setIcon(this.contentInVisible);
    toggleVisibility.setBorder(null);

    toggleVisibility.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            firePropertyChange("contentVisibility", visible, !visible); // $NON-NLS-1$
            visible = !visible;
            updateButton();
          }
        });

    add(toggleVisibility);

    add(Box.createGlue());

    titleLabel = new JLabel(title);
    titleLabel.setFont(UIManager.getFont("TitledBorder.font")); // $NON-NLS-1$
    add(titleLabel);

    add(Box.createGlue());

    updateUI();
  }
  public QuickNotepadToolPanel(QuickNotepad qnpad) {
    setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
    pad = qnpad;

    Box labelBox = new Box(BoxLayout.Y_AXIS);
    labelBox.add(Box.createGlue());

    label = new JLabel(pad.getFilename());
    label.setVisible(
        jEdit.getProperty(QuickNotepadPlugin.OPTION_PREFIX + "show-filepath").equals("true"));

    labelBox.add(label);
    labelBox.add(Box.createGlue());

    add(labelBox);

    add(Box.createGlue());

    add(
        makeCustomButton(
            "quicknotepad.choose-file",
            new ActionListener() {
              public void actionPerformed(ActionEvent evt) {
                QuickNotepadToolPanel.this.pad.chooseFile();
              }
            }));
    add(
        makeCustomButton(
            "quicknotepad.save-file",
            new ActionListener() {
              public void actionPerformed(ActionEvent evt) {
                QuickNotepadToolPanel.this.pad.saveFile();
              }
            }));
    add(
        makeCustomButton(
            "quicknotepad.copy-to-buffer",
            new ActionListener() {
              public void actionPerformed(ActionEvent evt) {
                QuickNotepadToolPanel.this.pad.copyToBuffer();
              }
            }));
  }
Exemplo n.º 15
0
 private JComponent createToolPanel() {
   JComponent box = Box.createVerticalBox();
   JCheckBox button = new JCheckBox(disablingItem.getText());
   button.setModel(disablingItem.getModel());
   box.add(Box.createGlue());
   box.add(button);
   box.add(Box.createGlue());
   JRadioButton blur = new JRadioButton(blurItem.getText());
   blur.setModel(blurItem.getModel());
   box.add(blur);
   JRadioButton emboss = new JRadioButton(embossItem.getText());
   emboss.setModel(embossItem.getModel());
   box.add(emboss);
   JRadioButton translucent = new JRadioButton(busyPainterItem.getText());
   translucent.setModel(busyPainterItem.getModel());
   box.add(translucent);
   box.add(Box.createGlue());
   return box;
 }
Exemplo n.º 16
0
    private JTextField addField(JPanel directoryPanel, String label, String defaultText) {
      JTextField field = new JTextField(defaultText);

      directoryPanel.add(new JLabel(label, SwingConstants.RIGHT));

      Box fieldBox = new Box(BoxLayout.Y_AXIS);
      fieldBox.add(Box.createGlue());
      Dimension dim = field.getPreferredSize();
      dim.width = Integer.MAX_VALUE;
      field.setMaximumSize(dim);
      fieldBox.add(field);
      fieldBox.add(Box.createGlue());
      directoryPanel.add(fieldBox);
      JButton choose = new JButton("Choose...");
      choose.setRequestFocusEnabled(false);
      choose.addActionListener(new ActionHandler(field));
      directoryPanel.add(choose);

      return field;
    }
Exemplo n.º 17
0
  public JPanel demo(Graph g, final String label) {
    // create a new radial tree view
    final PhysioMapRadialGraphView gview =
        new PhysioMapRadialGraphView(settings, g, label, semsimmodel);
    Visualization vis = gview.getVisualization();

    // create a search panel for the tree map
    SearchQueryBinding sq =
        new SearchQueryBinding(
            (Table) vis.getGroup(treeNodes),
            label,
            (SearchTupleSet) vis.getGroup(Visualization.SEARCH_ITEMS));
    JSearchPanel search = sq.createSearchPanel();
    search.setShowResultCount(true);
    search.setBorder(BorderFactory.createEmptyBorder(5, 5, 4, 0));
    search.setFont(FontLib.getFont("Verdana", Font.PLAIN, 11));

    final JTextArea title = new JTextArea();
    title.setPreferredSize(new Dimension(450, 500));
    title.setMaximumSize(new Dimension(450, 500));
    title.setMinimumSize(new Dimension(450, 500));

    title.setAlignmentY(CENTER_ALIGNMENT);
    title.setLineWrap(true);
    title.setWrapStyleWord(true);
    title.setBorder(BorderFactory.createEmptyBorder(3, 0, 0, 0));
    title.setFont(FontLib.getFont("Verdana", Font.PLAIN, 11));

    gview.addControlListener(
        new ControlAdapter() {
          public void itemEntered(VisualItem item, MouseEvent e) {}

          public void itemExited(VisualItem item, MouseEvent e) {
            title.setText(null);
          }
        });

    Box searchbox = new Box(BoxLayout.X_AXIS);
    searchbox.add(Box.createHorizontalStrut(10));
    searchbox.add(search);
    searchbox.add(Box.createHorizontalStrut(3));

    JPanel panel = new JPanel(new BorderLayout());
    panel.add(searchbox, BorderLayout.NORTH);
    panel.add(gview, BorderLayout.CENTER);
    panel.add(Box.createGlue(), BorderLayout.SOUTH);

    Color BACKGROUND = Color.WHITE;
    Color FOREGROUND = Color.DARK_GRAY;
    UILib.setColor(panel, BACKGROUND, FOREGROUND);

    return panel;
  }
Exemplo n.º 18
0
	private void computeContents() {
		subpanel.removeAll();
		ToolbarModel m = model;
		if (m != null) {
			for (ToolbarItem item : m.getItems()) {
				subpanel.add(new ToolbarButton(this, item));
			}
			subpanel.add(javax.swing.Box.createGlue());
		}
		postInvalidate();
		//TODO revalidate();
	}
Exemplo n.º 19
0
  /** Initialise the user interface. */
  protected void initUI() {
    // Add an action to close the window (appears in File menu
    // and action bar).
    ImageIcon image = new ImageIcon(ImageHolder.class.getResource("close.gif"));
    CloseAction closeAction = new CloseAction("Close", image, "Close window");
    JButton closeButton = new JButton(closeAction);

    // Add an action to apply the current generator.
    image = new ImageIcon(ImageHolder.class.getResource("accept.gif"));
    ApplyAction applyAction = new ApplyAction("Apply", image, "Apply current generator");
    JButton applyButton = new JButton(applyAction);

    JPanel windowActionBar = new JPanel();
    windowActionBar.setLayout(new BoxLayout(windowActionBar, BoxLayout.X_AXIS));
    windowActionBar.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
    windowActionBar.add(Box.createGlue());
    windowActionBar.add(applyButton);
    windowActionBar.add(Box.createGlue());
    windowActionBar.add(closeButton);
    windowActionBar.add(Box.createGlue());

    // Set the the menuBar.
    setJMenuBar(menuBar);

    // Create and populate the File menu.
    JMenu fileMenu = new JMenu("File");
    fileMenu.setMnemonic(KeyEvent.VK_F);
    menuBar.add(fileMenu);
    fileMenu.add(closeAction).setMnemonic(KeyEvent.VK_C);

    //  Menu of useful pre-defined functions.
    JMenu functions = new JMenu("Functions");
    functions.setMnemonic(KeyEvent.VK_F);
    menuBar.add(functions);
    coordinateGenerator.addPreDefined(functions);

    //  Finally add components to main window.
    getContentPane().add(coordinateGenerator, BorderLayout.CENTER);
    getContentPane().add(windowActionBar, BorderLayout.SOUTH);
  }
Exemplo n.º 20
0
  public Component getDemoPanel() {
    // register two converters. Both for CustomType but the first one is the default, the second one
    // is for a special case.
    ObjectConverterManager.registerConverter(CustomType.class, new DefaultCustomTypeConverter());
    ObjectConverterManager.registerConverter(
        CustomType.class, new SpecialCustomTypeConverter(), SpecialCustomTypeConverter.CONTEXT);

    JPanel panel = new JPanel();
    panel.setLayout(new JideBoxLayout(panel, BoxLayout.Y_AXIS));

    CustomType[] customTypes =
        new CustomType[] {
          new CustomType(1, "JIDE Docking Framework"),
          new CustomType(2, "JIDE Action Framework"),
          new CustomType(3, "JIDE Components"),
          new CustomType(4, "JIDE Grids"),
          new CustomType(5, "JIDE Dialogs"),
        };

    panel.add(
        new JLabel(
            "<HTML>We defined a CustomType class which has two fields. See below."
                + "<PRE><BR> <FONT COLOR=\"BLUE\">public class</FONT> CustomType {"
                + "<BR>    <FONT COLOR=\"BLUE\">int</FONT> <FONT COLOR=\"PURPLE\">_intValue</FONT>;"
                + "<BR>    String <FONT COLOR=\"PURPLE\">_stringValue</FONT>;"
                + "<BR> }"
                + "<BR></PRE>"
                + "</HTML>"));

    panel.add(Box.createVerticalStrut(24), JideBoxLayout.FIX);

    panel.add(new JLabel("This ListComboBox uses default converter for this custom type"));
    panel.add(Box.createVerticalStrut(6), JideBoxLayout.FIX);

    AbstractComboBox comboBox1 = createListComboBox(customTypes);
    panel.add(comboBox1);

    panel.add(Box.createVerticalStrut(12), JideBoxLayout.FIX);

    panel.add(new JLabel("This one uses a special converter for this custom type"));
    panel.add(Box.createVerticalStrut(6), JideBoxLayout.FIX);
    AbstractComboBox comboBox2 = createListComboBox(customTypes);
    //        comboBox2.setEditable(false);
    // set the context to use the special converter.
    comboBox2.setConverterContext(SpecialCustomTypeConverter.CONTEXT);
    panel.add(comboBox2);

    panel.add(Box.createVerticalStrut(12), JideBoxLayout.FIX);

    panel.add(Box.createGlue(), JideBoxLayout.VARY);
    return panel;
  }
Exemplo n.º 21
0
  public static void main(String[] args) {
    JFrame frame = new JFrame("Demo of Additional Borders");
    frame.setIconImage(JideIconsFactory.getImageIcon(JideIconsFactory.JIDE32).getImage());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setLayout(new BorderLayout());

    JPanel panel = new JPanel();
    panel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
    panel.setLayout(new JideBoxLayout(panel, JideBoxLayout.Y_AXIS, 10));

    JTextArea textField = new JTextArea();
    JPanel border = new JPanel(new BorderLayout());
    border.setPreferredSize(new Dimension(100, 100));
    border.add(new JScrollPane(textField), BorderLayout.CENTER);
    border.setBorder(
        new JideTitledBorder(
            new PartialEtchedBorder(PartialEtchedBorder.LOWERED, PartialSide.NORTH),
            "PartialEtchedBorder"));

    JTextArea textField2 = new JTextArea();
    JPanel border2 = new JPanel(new BorderLayout());
    border2.setPreferredSize(new Dimension(100, 100));
    border2.add(new JScrollPane(textField2), BorderLayout.CENTER);
    border2.setBorder(
        new JideTitledBorder(
            new PartialLineBorder(Color.darkGray, 1, PartialSide.NORTH), "PartialLineBorder"));

    JTextArea textField3 = new JTextArea();
    JPanel border3 = new JPanel(new BorderLayout());
    border3.setPreferredSize(new Dimension(100, 100));
    border3.add(new JScrollPane(textField3), BorderLayout.CENTER);
    border3.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder(
                new PartialLineBorder(Color.gray, 1, true), "Rounded Corners Border"),
            BorderFactory.createEmptyBorder(0, 6, 4, 6)));

    panel.add(border, JideBoxLayout.FLEXIBLE);
    panel.add(Box.createVerticalStrut(12));
    panel.add(border2, JideBoxLayout.FLEXIBLE);
    panel.add(Box.createVerticalStrut(12));
    panel.add(border3, JideBoxLayout.FLEXIBLE);
    panel.add(Box.createGlue(), JideBoxLayout.VARY);

    panel.setPreferredSize(new Dimension(500, 400));
    frame.getContentPane().add(panel, BorderLayout.CENTER);
    frame.pack();
    frame.setVisible(true);
  }
Exemplo n.º 22
0
    private void init() {
      Color c = getSelectedColor();
      if (c == null) chooser = new JColorChooser();
      else chooser = new JColorChooser(c);

      getContentPane().add(BorderLayout.CENTER, chooser);

      Box buttons = new Box(BoxLayout.X_AXIS);
      buttons.add(Box.createGlue());

      ok = new JButton(jEdit.getProperty("common.ok"));
      ok.addActionListener(this);
      buttons.add(ok);
      buttons.add(Box.createHorizontalStrut(6));
      getRootPane().setDefaultButton(ok);
      cancel = new JButton(jEdit.getProperty("common.cancel"));
      cancel.addActionListener(this);
      buttons.add(cancel);
      buttons.add(Box.createGlue());

      getContentPane().add(BorderLayout.SOUTH, buttons);
      pack();
      setLocationRelativeTo(getParent());
    }
Exemplo n.º 23
0
  /** @see pong.ApplicationState#init() */
  @Override
  public void init() {
    JFrame.setDefaultLookAndFeelDecorated(false);

    // Set background scene.

    backgroundScene =
        new PhysicsScene(CollidableMap.getMainMenuMap(), null, null, .0f, new RandomBallStrategy());

    // Create GUI.
    mainFrame = new PongFrame("Pong Adventures -Main menu-", backgroundScene, false, null, false);
    mainFrame.addWindowListener(this);
    mainFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    mainFrame.setResizable(false);

    // Setting frame to center of screen.
    Point center = GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint();
    mainFrame.setBounds(
        center.x - Global.windowSize.width / 2,
        center.y - Global.windowSize.height / 2,
        Global.windowSize.width,
        Global.windowSize.height);

    newGameButton = new JButton("New Game");
    newGameButton.setAlignmentX(Component.CENTER_ALIGNMENT);
    newGameButton.addActionListener(this);

    settingsButton = new JButton("Settings");
    settingsButton.setAlignmentX(Component.CENTER_ALIGNMENT);
    settingsButton.addActionListener(this);

    exitButton = new JButton("Exit");
    exitButton.setAlignmentX(Component.CENTER_ALIGNMENT);
    exitButton.addActionListener(this);

    Container content = mainFrame.getContentPane();
    content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));

    content.add(Box.createGlue());
    content.add(Box.createGlue());
    content.add(newGameButton);
    content.add(Box.createGlue());
    content.add(settingsButton);
    content.add(Box.createGlue());
    content.add(exitButton);
    content.add(Box.createGlue());
    content.add(Box.createGlue());

    mainFrame.setVisible(true);

    Debugger.debugWriteln("Initializing main menu.", this.getClass());
  }
Exemplo n.º 24
0
  protected JPanel getTopBanner() {
    if (topBanner == null) {
      topBanner = new ImagePanel(UIImages.ABOUT_DIALOG_TOP_BANNER_IMG.getImage(), Style.FIT_PANEL);
      topBanner.setLayout(new GridBagLayout());
      GridBagConstraints gc = new GridBagConstraints();
      gc.insets = new Insets(2, 2, 2, 2);
      gc.weightx = 1;
      gc.weighty = 1;
      gc.gridwidth = GridBagConstraints.REMAINDER;
      gc.fill = GridBagConstraints.BOTH;
      appNameLabel = new JLabel(UILabels.STL91000_ABOUT_APP.getDescription(appNameStr, appVersion));
      appNameLabel.setFont(UIConstants.H2_FONT.deriveFont(Font.BOLD));
      appNameLabel.setForeground(UIConstants.INTEL_WHITE);
      appNameLabel.setHorizontalAlignment(JLabel.CENTER);
      appNameLabel.setVerticalAlignment(JLabel.CENTER);
      appNameLabel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
      topBanner.add(appNameLabel, gc);

      gc.weightx = 0;
      gc.weighty = 0;
      gc.gridwidth = 1;
      appBuildIdLabel = new JLabel(UILabels.STL91001_BUILD_ID.getDescription(appBuildIdStr));
      /*-
       * We are now constructing the version number using the BuildId
      appBuildIdLabel.setFont(UIConstants.H5_FONT);
      appBuildIdLabel.setForeground(UIConstants.INTEL_WHITE);
      appBuildIdLabel.setHorizontalTextPosition(JLabel.LEADING);
      topBanner.add(appBuildIdLabel, gc);
       */

      gc.weightx = 1;
      topBanner.add(Box.createGlue(), gc);

      gc.weightx = 0;
      gc.gridwidth = GridBagConstraints.REMAINDER;
      appBuildDateLabel = new JLabel(UILabels.STL91002_BUILD_DATE.getDescription(appBuildDateStr));
      appBuildDateLabel.setFont(UIConstants.H5_FONT);
      appBuildDateLabel.setForeground(UIConstants.INTEL_WHITE);
      appBuildDateLabel.setHorizontalTextPosition(JLabel.LEADING);
      topBanner.add(appBuildDateLabel, gc);
    }
    return topBanner;
  }
Exemplo n.º 25
0
 public void resetDetailPane() {
   detailPane.removeAll();
   Dimension d = new Dimension(0, 3);
   detailPane.setOpaque(false);
   detPaneHolder.setOpaque(false);
   if (selectedContact != null && selectedContact.getProperties() != null) {
     String[][] properties = selectedContact.getProperties();
     for (String[] property : properties) {
       javax.swing.JSeparator space = new JSeparator(SwingConstants.HORIZONTAL);
       space.setSize(d);
       detailPane.add(space);
       DetInnerPaneBlocks dipb = new DetInnerPaneBlocks(property[0], property[1]);
       detailPane.add(dipb);
     }
     detailPane.add(Box.createGlue());
     detailPane.setSize(0, (DetInnerPaneBlocks.height + d.height) * properties.length);
   } else {
     detailPane.setSize(0, 0);
   }
   resetDetPaneHolderSize();
 }
Exemplo n.º 26
0
  /** Creates the layout of the panel (but the contents are not populated here). */
  private void createLayout() {
    GridBagConstraints gbc = new GridBagConstraints();
    JLabel lTitle = Utilities.createTitleLabel(INFO_CTRL_PANEL_ENTRY_CACHES.get());
    gbc.fill = GridBagConstraints.NONE;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.gridwidth = 2;
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.insets.top = 5;
    gbc.insets.bottom = 7;
    add(lTitle, gbc);

    gbc.insets.bottom = 0;
    gbc.insets.top = 10;
    gbc.gridy++;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.gridwidth = 1;
    for (int i = 0; i < ngOperations.size(); i++) {
      gbc.gridy++;
      gbc.insets.left = 0;
      gbc.gridx = 0;
      gbc.weightx = 0.0;
      gbc.gridwidth = 1;
      add(labels.get(i), gbc);
      gbc.insets.left = 10;
      gbc.gridx = 1;
      gbc.gridwidth = 2;
      add(monitoringLabels.get(i), gbc);
    }

    gbc.gridx = 0;
    gbc.gridy++;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.weightx = 1.0;
    gbc.weighty = 1.0;
    gbc.gridwidth = 3;
    add(Box.createGlue(), gbc);

    setBorder(PANEL_BORDER);
  }
  /** Builds and lays out the UI. */
  private void buildGUI() {
    JPanel scrollPanel = new JPanel();
    JPanel containerPanel = new JPanel();
    containerPanel.setLayout(new BoxLayout(containerPanel, BoxLayout.X_AXIS));
    JPanel tPanel = tablePanel();
    containerPanel.add(zSlider);
    containerPanel.add(tPanel);
    JPanel cPanel = new JPanel();
    cPanel.setLayout(new BoxLayout(cPanel, BoxLayout.Y_AXIS));
    cPanel.add(containerPanel);
    cPanel.add(tSlider);
    JPanel buttonPanel = createButtonPanel();

    scrollPanel.setLayout(new BoxLayout(scrollPanel, BoxLayout.X_AXIS));
    scrollPanel.add(cPanel);
    scrollPanel.add(buttonPanel);
    scrollPanel.add(Box.createGlue());

    this.setLayout(new BorderLayout());
    this.add(scrollPanel, BorderLayout.CENTER);
    intensityDialog = new IntensityValuesDialog(view, tableModel);
  }
Exemplo n.º 28
0
 public void render(final HistoryNode node) {
   removeAll();
   final Insets insets = new Insets(5, 0, 0, 0);
   m_title.setText(node.getTitle());
   add(
       m_scroll,
       new GridBagConstraints(
           0, 0, 1, 1, 1, 0.1, GridBagConstraints.NORTH, GridBagConstraints.BOTH, insets, 0, 0));
   final GridBagConstraints mainConstraints =
       new GridBagConstraints(
           0, 1, 1, 1, 1, 0.9, GridBagConstraints.NORTH, GridBagConstraints.BOTH, insets, 0, 0);
   if (node instanceof Renderable) {
     final Object details = ((Renderable) node).getRenderingData();
     if (details instanceof Collection) {
       @SuppressWarnings("unchecked")
       final Collection<Object> objects = (Collection<Object>) details;
       final Iterator<Object> objIter = objects.iterator();
       if (objIter.hasNext()) {
         final Object obj = objIter.next();
         if (obj instanceof Unit) {
           @SuppressWarnings("unchecked")
           final Collection<Unit> units = (Collection<Unit>) details;
           renderUnits(mainConstraints, units);
         }
       }
     }
     /*
     else if (details instanceof Territory)
     {
     	final Territory t = (Territory) details;
     	if (!m_mapPanel.isShowing(t))
     		m_mapPanel.centerOn(t);
     }
     */
   }
   add(Box.createGlue());
   validate();
   repaint();
 }
Exemplo n.º 29
0
  public void setSelectedResources(FVResourceNode[] resources) {
    resourcesPanel.removeAll();
    if (resources == null || resources.length == 0) {
      return;
    }

    GridBagConstraints gc = new GridBagConstraints();
    gc.fill = GridBagConstraints.HORIZONTAL;
    gc.gridwidth = GridBagConstraints.REMAINDER;
    gc.weightx = 1;
    gc.insets = new Insets(0, 2, 0, 2);
    for (int i = 0; i < resources.length; i++) {
      FVResourceNode resource = resources[i];
      JLabel label = ComponentFactory.getH4Label(getResoureName(resource), Font.PLAIN);
      label.setIcon(resource.getType().getIcon());
      label.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.INTEL_BORDER_GRAY));
      style.decorateKey(label, i);
      resourcesPanel.add(label, gc);
    }
    gc.weighty = 1;
    gc.fill = GridBagConstraints.BOTH;
    resourcesPanel.add(Box.createGlue(), gc);
  }
  protected void createToolBar() {
    JLabel label1 = new JLabel("Tuple:");
    JLabel label2 = new JLabel("Member:");

    JToolBar toolBar1 = new JToolBar();
    toolBar1.setFloatable(false);
    toolBar1.add(getResetAction());

    JToolBar toolBar2 = new JToolBar();
    toolBar2.setFloatable(false);
    toolBar2.add(getDeleteAction());
    toolBar2.addSeparator();
    toolBar2.add(getEvaluateAction());

    Box hBox = Box.createHorizontalBox();
    hBox.add(label1);
    hBox.add(toolBar1);
    hBox.add(Box.createGlue());
    hBox.add(label2);
    hBox.add(toolBar2);
    this.toolBarPanel = new JPanel(new BorderLayout());
    this.toolBarPanel.add(hBox, BorderLayout.CENTER);
  }