/** * Create a button to go inside of the toolbar. By default this will load an image resource. The * image filename is relative to the classpath (including the '.' directory if its a part of the * classpath), and may either be in a JAR file or a separate file. * * @param key The key in the resource file to serve as the basis of lookups. */ protected JButton createToolbarButton(String key) { URL url = getResource(key + imageSuffix); JButton b = new JButton(new ImageIcon(url)) { @Override public float getAlignmentY() { return 0.5f; } }; b.setRequestFocusEnabled(false); b.setMargin(new Insets(1, 1, 1, 1)); String astr = getProperty(key + actionSuffix); if (astr == null) { astr = key; } Action a = getAction(astr); if (a != null) { b.setActionCommand(astr); b.addActionListener(a); } else { b.setEnabled(false); } String tip = getResourceString(key + tipSuffix); if (tip != null) { b.setToolTipText(tip); } return b; }
/** Simple convenience routine for adding a button/icon to a Toolbar */ public static JButton addTool(JToolBar toolBar, String name) { JButton b; b = new JButton(new ImageIcon("images/" + name + ".gif", name)); toolBar.add(b); b.setToolTipText(name); b.setMargin(new Insets(0, 0, 0, 0)); b.getAccessibleContext().setAccessibleName(name); return b; }
private JButton makeToolbarButton(String name, String toolTipText, String action) { // Create and initialize the button. JButton button = new JButton(makeImageIcon(name)); button.setToolTipText(toolTipText); button.setActionCommand(action); button.addActionListener(this); return button; }
protected void addMyControls() { // add browser-style control buttons JButton home = new JButton(new ImageIcon("data/Home24.gif")); JButton back = new JButton(new ImageIcon("data/Back24.gif")); JButton fwd = new JButton(new ImageIcon("data/Forward24.gif")); home.setToolTipText("Home"); home.addActionListener(this); home.setActionCommand(homeCmd); back.setToolTipText("Back"); back.addActionListener(this); back.setActionCommand(backCmd); back.setEnabled(false); // initially disabled fwd.setToolTipText("Forward"); fwd.addActionListener(this); fwd.setActionCommand(forwardCmd); fwd.setEnabled(false); // initially disabled add(home); add(back); add(fwd); add(new JToolBar.Separator()); // set built-in index variables homeIndex = getComponentIndex(home); backIndex = getComponentIndex(back); forwardIndex = getComponentIndex(fwd); JComboBox comboBox = new JComboBox(); comboBox.setEditable(true); comboBox.addActionListener(this); comboBox.setActionCommand(comboCmd); comboBox.setMaximumRowCount(3); // don't let it get too long comboBox.insertItemAt(mainBrowserURL, 0); // don't start it out empty add(comboBox); comboBoxIndex = getComponentIndex(comboBox); }
/** Make the button for navigating to the default folder. */ protected Component makeDefaultFolderNavigationButton() { final JButton goButton = new JButton("Default Folder"); goButton.setToolTipText("Navigate to the default folder."); goButton.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent event) { try { handleToDefaultFolderAction(); } catch (Exception exception) { reportException(exception); } } }); return goButton; }
public ListDataEventDemo() { super(new BorderLayout()); // Create and populate the list model. listModel = new DefaultListModel(); listModel.addElement("Whistler, Canada"); listModel.addElement("Jackson Hole, Wyoming"); listModel.addElement("Squaw Valley, California"); listModel.addElement("Telluride, Colorado"); listModel.addElement("Taos, New Mexico"); listModel.addElement("Snowbird, Utah"); listModel.addElement("Chamonix, France"); listModel.addElement("Banff, Canada"); listModel.addElement("Arapahoe Basin, Colorado"); listModel.addElement("Kirkwood, California"); listModel.addElement("Sun Valley, Idaho"); listModel.addListDataListener(new MyListDataListener()); // Create the list and put it in a scroll pane. list = new JList(listModel); list.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); list.setSelectedIndex(0); list.addListSelectionListener(this); JScrollPane listScrollPane = new JScrollPane(list); // Create the list-modifying buttons. addButton = new JButton(addString); addButton.setActionCommand(addString); addButton.addActionListener(new AddButtonListener()); deleteButton = new JButton(deleteString); deleteButton.setActionCommand(deleteString); deleteButton.addActionListener(new DeleteButtonListener()); ImageIcon icon = createImageIcon("Up16"); if (icon != null) { upButton = new JButton(icon); upButton.setMargin(new Insets(0, 0, 0, 0)); } else { upButton = new JButton("Move up"); } upButton.setToolTipText("Move the currently selected list item higher."); upButton.setActionCommand(upString); upButton.addActionListener(new UpDownListener()); icon = createImageIcon("Down16"); if (icon != null) { downButton = new JButton(icon); downButton.setMargin(new Insets(0, 0, 0, 0)); } else { downButton = new JButton("Move down"); } downButton.setToolTipText("Move the currently selected list item lower."); downButton.setActionCommand(downString); downButton.addActionListener(new UpDownListener()); JPanel upDownPanel = new JPanel(new GridLayout(2, 1)); upDownPanel.add(upButton); upDownPanel.add(downButton); // Create the text field for entering new names. nameField = new JTextField(15); nameField.addActionListener(new AddButtonListener()); String name = listModel.getElementAt(list.getSelectedIndex()).toString(); nameField.setText(name); // Create a control panel, using the default FlowLayout. JPanel buttonPane = new JPanel(); buttonPane.add(nameField); buttonPane.add(addButton); buttonPane.add(deleteButton); buttonPane.add(upDownPanel); // Create the log for reporting list data events. log = new JTextArea(10, 20); JScrollPane logScrollPane = new JScrollPane(log); // Create a split pane for the log and the list. JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, listScrollPane, logScrollPane); splitPane.setResizeWeight(0.5); // Put everything together. add(buttonPane, BorderLayout.PAGE_START); add(splitPane, BorderLayout.CENTER); }
public void createGUI() { setLayout(new BorderLayout()); toolBar = new JToolBar("options", JToolBar.HORIZONTAL); toolBar.setFloatable(false); toolBar.setOpaque(true); toolBar.setBackground(new Color(154, 12, 12)); toolBar.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 15)); selectAllCB = new JCheckBox("Select All"); selectAllCB.setVisible(false); selectAllCB.setForeground(Color.white); selectAllCB.addActionListener(this); refreshBut = new JButton(new ImageIcon(this.getClass().getResource("/images/reloadIcon.png"))); refreshBut.setVisible(false); refreshBut.setToolTipText("Refresh"); refreshBut.setForeground(new Color(20, 88, 49)); refreshBut.addActionListener(this); backBut = new JButton(new ImageIcon(this.getClass().getResource("/images/backIcon.png"))); backBut.setVisible(false); backBut.setToolTipText("Back"); backBut.setForeground(new Color(20, 88, 49)); backBut.addActionListener(this); deleteBut = new JButton(new ImageIcon(this.getClass().getResource("/images/trashIcon.png"))); deleteBut.setToolTipText("Delete"); deleteBut.setForeground(Color.red); deleteBut.setVisible(false); deleteBut.addActionListener(this); deleteBut.setBackground(Color.red); restoreBut = new JButton(new ImageIcon(this.getClass().getResource("/images/restoreIcon.png"))); restoreBut.setToolTipText("Restore"); restoreBut.setForeground(Color.blue); restoreBut.setVisible(false); restoreBut.addActionListener(this); toolBar.addSeparator(new Dimension(10, 5)); toolBar.add(selectAllCB); toolBar.add(backBut); toolBar.add(refreshBut); toolBar.add(deleteBut); toolBar.add(restoreBut); add(toolBar, "North"); JPanel centPan = new JPanel(new GridBagLayout()); centPan.setBackground(new Color(52, 86, 70)); JLabel label = new JLabel("Select A Category From Left Pane"); label.setFont(new Font("arial", Font.BOLD, 35)); label.setForeground(Color.yellow); centPan.add(label); contentPan = new JScrollPane(centPan); contentPan.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); add(contentPan, "Center"); contentPan.repaint(); db = new Database(); // inboxSet = db.getData("SELECT * FROM messages WHERE tag='inbox' ORDER BY msg_id // desc"); // sentmailSet = db.getData("SELECT * FROM messages WHERE tag='sentmail' ORDER BY msg_id // desc"); // draftSet = db.getData("SELECT * FROM messages WHERE tag='draft' ORDER BY msg_id // desc"); // outboxSet = db.getData("SELECT * FROM messages WHERE tag='outbox' ORDER BY msg_id // desc"); // trashSet = db.getData("SELECT * FROM messages,trash WHERE messages.tag='trash' and // messages.msg_id=trash.msg_id ORDER BY deleted_at desc"); }
public JMovieControlAqua() { // Set the background color to the border color of the buttons. // This way the toolbar won't look too ugly when the buttons // are displayed before they have been loaded completely. // setBackground(new Color(118, 118, 118)); setBackground(Color.WHITE); Dimension buttonSize = new Dimension(16, 16); GridBagLayout gridbag = new GridBagLayout(); Insets margin = new Insets(0, 0, 0, 0); setLayout(gridbag); GridBagConstraints c; ResourceBundle labels = ResourceBundle.getBundle("org.monte.media.Labels"); colorCyclingButton = new JToggleButton(); colorCyclingButton.setToolTipText(labels.getString("colorCycling.toolTipText")); colorCyclingButton.addActionListener(this); colorCyclingButton.setPreferredSize(buttonSize); colorCyclingButton.setMinimumSize(buttonSize); colorCyclingButton.setVisible(false); colorCyclingButton.setMargin(margin); c = new GridBagConstraints(); // c.gridx = 0; // c.gridy = 0; gridbag.setConstraints(colorCyclingButton, c); add(colorCyclingButton); audioButton = new JToggleButton(); audioButton.setToolTipText(labels.getString("audio.toolTipText")); audioButton.addActionListener(this); audioButton.setPreferredSize(buttonSize); audioButton.setMinimumSize(buttonSize); audioButton.setVisible(false); audioButton.setMargin(margin); c = new GridBagConstraints(); // c.gridx = 0; // c.gridy = 0; gridbag.setConstraints(audioButton, c); add(audioButton); startButton = new JToggleButton(); startButton.setToolTipText(labels.getString("play.toolTipText")); startButton.addActionListener(this); startButton.setPreferredSize(buttonSize); startButton.setMinimumSize(buttonSize); startButton.setMargin(margin); c = new GridBagConstraints(); // c.gridx = 1; // c.gridy = 0; gridbag.setConstraints(startButton, c); add(startButton); slider = new JMovieSliderAqua(); c = new GridBagConstraints(); // c.gridx = 2; // c.gridy = 0; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; gridbag.setConstraints(slider, c); add(slider); rewindButton = new JButton(); rewindButton.setToolTipText(labels.getString("previous.toolTipText")); rewindButton.setPreferredSize(buttonSize); rewindButton.setMinimumSize(buttonSize); rewindButton.setMargin(margin); c = new GridBagConstraints(); // c.gridx = 3; // c.gridy = 0; gridbag.setConstraints(rewindButton, c); add(rewindButton); rewindButton.addActionListener(this); forwardButton = new JButton(); forwardButton.setToolTipText(labels.getString("next.toolTipText")); buttonSize = new Dimension(17, 16); forwardButton.setPreferredSize(buttonSize); forwardButton.setMinimumSize(buttonSize); forwardButton.setMargin(margin); c = new GridBagConstraints(); // c.gridx = 4; // c.gridy = 0; gridbag.setConstraints(forwardButton, c); add(forwardButton); forwardButton.addActionListener(this); // The spacer is used when the play controls are hidden spacer = new JPanel(new BorderLayout()); spacer.setVisible(false); spacer.setPreferredSize(new Dimension(16, 16)); spacer.setMinimumSize(new Dimension(16, 16)); spacer.setOpaque(false); c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; gridbag.setConstraints(spacer, c); add(spacer); Border border = new BackdropBorder( new ButtonStateBorder( new ImageBevelBorder( Images.createImage(getClass(), "images/Player.border.png"), new Insets(1, 1, 1, 1), new Insets(0, 4, 1, 4)), new ImageBevelBorder( Images.createImage(getClass(), "images/Player.borderP.png"), new Insets(1, 1, 1, 1), new Insets(0, 4, 1, 4)))); Border westBorder = new BackdropBorder( new ButtonStateBorder( new ImageBevelBorder( Images.createImage(getClass(), "images/Player.borderWest.png"), new Insets(1, 1, 1, 0), new Insets(0, 4, 1, 4)), new ImageBevelBorder( Images.createImage(getClass(), "images/Player.borderWestP.png"), new Insets(1, 1, 1, 0), new Insets(0, 4, 1, 4)))); startButton.setBorder(westBorder); colorCyclingButton.setBorder(westBorder); audioButton.setBorder(westBorder); rewindButton.setBorder(westBorder); forwardButton.setBorder(border); startButton.setUI((ButtonUI) CustomButtonUI.createUI(startButton)); colorCyclingButton.setUI((ButtonUI) CustomButtonUI.createUI(audioButton)); audioButton.setUI((ButtonUI) CustomButtonUI.createUI(audioButton)); rewindButton.setUI((ButtonUI) CustomButtonUI.createUI(rewindButton)); forwardButton.setUI((ButtonUI) CustomButtonUI.createUI(forwardButton)); colorCyclingButton.setIcon( new ImageIcon(Images.createImage(getClass(), "images/PlayerStartColorCycling.png"))); colorCyclingButton.setSelectedIcon( new ImageIcon(Images.createImage(getClass(), "images/PlayerStartColorCycling.png"))); colorCyclingButton.setDisabledIcon( new ImageIcon( Images.createImage(getClass(), "images/PlayerStartColorCycling.disabled.png"))); audioButton.setIcon( new ImageIcon(Images.createImage(getClass(), "images/PlayerStartAudio.png"))); audioButton.setSelectedIcon( new ImageIcon(Images.createImage(getClass(), "images/PlayerStopAudio.png"))); audioButton.setDisabledIcon( new ImageIcon(Images.createImage(getClass(), "images/PlayerStartAudio.disabled.png"))); startButton.setIcon(new ImageIcon(Images.createImage(getClass(), "images/PlayerStart.png"))); startButton.setSelectedIcon( new ImageIcon(Images.createImage(getClass(), "images/PlayerStop.png"))); startButton.setDisabledIcon( new ImageIcon(Images.createImage(getClass(), "images/PlayerStart.disabled.png"))); rewindButton.setIcon(new ImageIcon(Images.createImage(getClass(), "images/PlayerBack.png"))); rewindButton.setDisabledIcon( new ImageIcon(Images.createImage(getClass(), "images/PlayerBack.disabled.png"))); forwardButton.setIcon(new ImageIcon(Images.createImage(getClass(), "images/PlayerNext.png"))); forwardButton.setDisabledIcon( new ImageIcon(Images.createImage(getClass(), "images/PlayerNext.disabled.png"))); // Automatic scrolling scrollHandler = new ScrollHandler(); scrollTimer = new Timer(60, scrollHandler); scrollTimer.setInitialDelay(300); // default InitialDelay? forwardButton.addMouseListener(scrollHandler); rewindButton.addMouseListener(scrollHandler); }
public SmartToolBar(RuntimeConfigFrame fr) { frame = fr; setFloatable(true); treeCombo = new TreeCombo(frame.model); treeCombo.addActionListener(new ComboListener()); treeCombo.setPreferredSize(new Dimension(210, 25)); treeCombo.setMinimumSize(new Dimension(210, 25)); treeCombo.setMaximumSize(new Dimension(210, 25)); add(treeCombo); addSeparator(); addSeparator(); addSeparator(); ToolBarAction toolBarAction = new ToolBarAction(); JButton saveAsButton = add(toolBarAction); ImageIcon icon = frame .getCommonBuilderUIImpl() .getScaledImage("file.png", "images/runtimeadmin", 28, 28, Image.SCALE_DEFAULT); saveAsButton.setPreferredSize(new Dimension(28, 28)); saveAsButton.setMinimumSize(new Dimension(28, 28)); saveAsButton.setMaximumSize(new Dimension(28, 28)); saveAsButton.setBorderPainted(false); saveAsButton.setIcon(icon); icon = frame .getCommonBuilderUIImpl() .getScaledImage("file_mo.png", "images/runtimeadmin", 28, 28, Image.SCALE_DEFAULT); saveAsButton.setRolloverIcon(icon); saveAsButton.setActionCommand("Apply To Server"); saveAsButton.setToolTipText(RuntimeConfigFrame.getString("Apply To Server")); addSeparator(); JButton close = add(toolBarAction); icon = frame .getCommonBuilderUIImpl() .getScaledImage("exit.png", "images/", 28, 28, Image.SCALE_DEFAULT); close.setPreferredSize(new Dimension(28, 28)); close.setMinimumSize(new Dimension(28, 28)); close.setMaximumSize(new Dimension(28, 28)); close.setIcon(icon); close.setBorderPainted(false); icon = frame .getCommonBuilderUIImpl() .getScaledImage("exit_mo.png", "images/", 28, 28, Image.SCALE_DEFAULT); close.setRolloverIcon(icon); close.setActionCommand("Close"); close.setToolTipText(RuntimeConfigFrame.getString("Close")); addSeparator(); JButton help = add(toolBarAction); icon = frame .getCommonBuilderUIImpl() .getScaledImage("toolhelp.png", "images/", 28, 28, Image.SCALE_DEFAULT); help.setPreferredSize(new Dimension(28, 28)); help.setMinimumSize(new Dimension(28, 28)); help.setMaximumSize(new Dimension(28, 28)); help.setBorderPainted(false); help.setIcon(icon); icon = frame .getCommonBuilderUIImpl() .getScaledImage("toolhelp_mo.png", "images/", 28, 28, Image.SCALE_DEFAULT); help.setRolloverIcon(icon); help.setActionCommand("Help Contents"); help.setToolTipText(RuntimeConfigFrame.getString("Help")); // addSeparator(); }
protected void initComponents( AirspaceBuilderModel model, final AirspaceBuilderController controller) { final JCheckBox resizeNewShapesCheckBox; final JCheckBox enableEditCheckBox; JPanel newShapePanel = new JPanel(); { JButton newShapeButton = new JButton("New shape"); newShapeButton.setActionCommand(NEW_AIRSPACE); newShapeButton.addActionListener(controller); newShapeButton.setToolTipText("Create a new shape centered in the viewport"); this.factoryComboBox = new JComboBox(defaultAirspaceFactories); this.factoryComboBox.setEditable(false); this.factoryComboBox.setToolTipText("Choose shape type to create"); resizeNewShapesCheckBox = new JCheckBox("Fit new shapes to viewport"); resizeNewShapesCheckBox.setActionCommand(SIZE_NEW_SHAPES_TO_VIEWPORT); resizeNewShapesCheckBox.addActionListener(controller); resizeNewShapesCheckBox.setSelected(controller.isResizeNewShapesToViewport()); resizeNewShapesCheckBox.setAlignmentX(Component.LEFT_ALIGNMENT); resizeNewShapesCheckBox.setToolTipText( "New shapes are sized to fit the geographic viewport"); enableEditCheckBox = new JCheckBox("Enable shape editing"); enableEditCheckBox.setActionCommand(ENABLE_EDIT); enableEditCheckBox.addActionListener(controller); enableEditCheckBox.setSelected(controller.isEnableEdit()); enableEditCheckBox.setAlignmentX(Component.LEFT_ALIGNMENT); enableEditCheckBox.setToolTipText("Allow modifications to shapes"); Box newShapeBox = Box.createHorizontalBox(); newShapeBox.add(newShapeButton); newShapeBox.add(Box.createHorizontalStrut(5)); newShapeBox.add(this.factoryComboBox); newShapeBox.setAlignmentX(Component.LEFT_ALIGNMENT); JPanel gridPanel = new JPanel(new GridLayout(0, 1, 0, 5)); // rows, cols, hgap, vgap gridPanel.add(newShapeBox); gridPanel.add(resizeNewShapesCheckBox); gridPanel.add(enableEditCheckBox); newShapePanel.setLayout(new BorderLayout()); newShapePanel.add(gridPanel, BorderLayout.NORTH); } JPanel entryPanel = new JPanel(); { this.entryTable = new JTable(model); this.entryTable.setColumnSelectionAllowed(false); this.entryTable.setRowSelectionAllowed(true); this.entryTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); this.entryTable .getSelectionModel() .addListSelectionListener( new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!ignoreSelectEvents) { controller.actionPerformed( new ActionEvent(e.getSource(), -1, SELECTION_CHANGED)); } } }); this.entryTable.setToolTipText("<html>Click to select<br>Double-Click to rename</html>"); JScrollPane tablePane = new JScrollPane(this.entryTable); tablePane.setPreferredSize(new Dimension(200, 100)); entryPanel.setLayout(new BorderLayout(0, 0)); // hgap, vgap entryPanel.add(tablePane, BorderLayout.CENTER); } JPanel selectionPanel = new JPanel(); { JButton delselectButton = new JButton("Deselect"); delselectButton.setActionCommand(CLEAR_SELECTION); delselectButton.addActionListener(controller); delselectButton.setToolTipText("Clear the selection"); JButton deleteButton = new JButton("Delete Selected"); deleteButton.setActionCommand(REMOVE_SELECTED); deleteButton.addActionListener(controller); deleteButton.setToolTipText("Delete selected shapes"); JPanel gridPanel = new JPanel(new GridLayout(0, 1, 0, 5)); // rows, cols, hgap, vgap gridPanel.add(delselectButton); gridPanel.add(deleteButton); selectionPanel.setLayout(new BorderLayout()); selectionPanel.add(gridPanel, BorderLayout.NORTH); } this.setLayout(new BorderLayout(30, 0)); // hgap, vgap this.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); // top, left, bottom, right this.add(newShapePanel, BorderLayout.WEST); this.add(entryPanel, BorderLayout.CENTER); this.add(selectionPanel, BorderLayout.EAST); controller.addPropertyChangeListener( new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { if (SIZE_NEW_SHAPES_TO_VIEWPORT.equals(e.getPropertyName())) { resizeNewShapesCheckBox.setSelected(controller.isResizeNewShapesToViewport()); } else if (ENABLE_EDIT.equals(e.getPropertyName())) { enableEditCheckBox.setSelected(controller.isEnableEdit()); } } }); }
public void initialize(final Controller controller) { super.initialize(controller); WWMenu fileMenu = (WWMenu) this.getController().getRegisteredObject(Constants.FILE_MENU); if (fileMenu != null) fileMenu.addMenu(this.getFeatureID()); this.tabbedPane = new JTabbedPane(); this.tabbedPane.setOpaque(false); this.tabbedPane.add(new JPanel()); this.tabbedPane.setTitleAt(0, "+"); // this tab is just a button for adding servers/panels this.tabbedPane.setToolTipTextAt(0, "Connect to WMS Server"); this.tabbedPane.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent changeEvent) { if (tabbedPane.getSelectedIndex() == 0) { addNewPanel(tabbedPane); // Add new panel when '+' is selected } } }); // Add an initial panel to the tabbed pane this.addNewPanel(this.tabbedPane); tabbedPane.setSelectedIndex(1); this.setTaskComponent(this.tabbedPane); this.setLocation(SwingConstants.CENTER, SwingConstants.CENTER); this.getJDialog().setResizable(true); JButton deleteButton = new JButton(ImageLibrary.getIcon("gov/nasa/worldwindow/images/delete-20x20.png")); deleteButton.setToolTipText("Remove Server"); deleteButton.setOpaque(false); deleteButton.setBackground(new Color(0, 0, 0, 0)); deleteButton.setBorderPainted(false); deleteButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { deleteCurrentPanel(); } }); deleteButton.setEnabled(true); this.insertLeftDialogComponent(deleteButton); // // JButton cancelButton = new JButton("Cancel"); // cancelButton.setToolTipText("Cancel capabilities retrieval from server"); // cancelButton.setOpaque(false); // cancelButton.addActionListener(new ActionListener() // { // public void actionPerformed(ActionEvent actionEvent) // { // cancelCurrentRetrieval(); // } // }); // this.insertRightDialogComponent(cancelButton); this.setTitle("WMS Servers"); this.dialog.validate(); this.dialog.pack(); }
/** Initializes all GUI components */ private void initComponents() { mainPanel = new JPanel(); editPanel = new JPanel(); editPanelLeft = new JPanel(); editPanelCenter = new JPanel(); editPanelRight = new JPanel(); tablePanel = new JPanel(); companyIdTextField = new JTextField(); companyIdTextField.setEditable(false); companyNameTextField = new JTextField(); urlTextField = new JTextField(); insuranceTypesTextField = new JTextField(); telephoneTextField = new JTextField(); percentageTextField = new JTextField(); percentageTextField.setToolTipText("<html>Only <b>numerical</b> values allowed</html>"); searchTextField = new JTextField(); searchTextField.setToolTipText( "<html>Use either <b>AND</b> or <b>OR</b> for combined search queries<br>You can also use <b>spaces</b> instead of <b>OR</b></html>"); generalDescriptionTextField = new JTextField(); companyIdLabel = new InsuranceCompanyLabel("ID"); companyNameLabel = new InsuranceCompanyLabel("Company"); urlLabel = new InsuranceCompanyLabel("Website"); insuranceTypesLabel = new InsuranceCompanyLabel("Insurance Types"); telephoneLabel = new InsuranceCompanyLabel("Telephone"); percentageLabel = new InsuranceCompanyLabel("Broker Percentage"); searchLabel = new InsuranceCompanyLabel("Search Insurance Types"); generalDescriptionLabel = new InsuranceCompanyLabel("General Description"); sortLabel = new InsuranceCompanyLabel("Sorting"); addInsuranceCompanyButton = new InsuranceCompanyButton("New Insurance Company", 190, 45); addInsuranceCompanyButton.setToolTipText( "<html>Create a new <b>empty</b> Insurance Company</html>"); saveInsuranceCompanyButton = new InsuranceCompanyButton("Save Insurance Company", 190, 45); saveInsuranceCompanyButton.setToolTipText( "<html>Save the <b>selected</b> Insurance Company<br>Hint: Press <b>Enter</b> to quickly save an entry</html>"); saveInsuranceCompanyButton.setDefaultCapable(true); getRootPane() .setDefaultButton( saveInsuranceCompanyButton); // Set the save button as default button, so quicker // editing by pressing Enter is possible deleteInsuranceCompanyButton = new InsuranceCompanyButton("Delete Insurance Company", 190, 45); deleteInsuranceCompanyButton.setToolTipText( "<html>Delete the <b>selected</b> Insurance Company</html>"); clearSearchButton = new InsuranceCompanyButton("x", 40, 35); clearSearchButton.setToolTipText("<html>Click to <b>clear</b> the search field</html>"); String[] sortStrategies = {"ID", "Company Name", "Percentage"}; sortComboBox = new JComboBox(sortStrategies); tableData = new InsuranceCompanyTableModel(model.getInsuranceCompanies()); insuranceCompaniesTable = new JTable(); insuranceCompanyScrollPane = new JScrollPane(insuranceCompaniesTable); // Set layout and add components to panels setLayout(new BorderLayout()); add(mainPanel, BorderLayout.CENTER); mainPanel.setLayout(new BorderLayout()); mainPanel.add(editPanel, BorderLayout.NORTH); editPanel.setBorder(new EmptyBorder(10, 10, 10, 10)); editPanel.setLayout(new BorderLayout()); editPanel.add(editPanelLeft, BorderLayout.CENTER); editPanelLeft.setBorder(new EmptyBorder(0, 0, 5, 15)); editPanelLeft.setLayout(new GridLayout(4, 4, 5, 0)); editPanelLeft.add(companyIdLabel); editPanelLeft.add(companyNameLabel); editPanelLeft.add(urlLabel); editPanelLeft.add(telephoneLabel); editPanelLeft.add(companyIdTextField); editPanelLeft.add(companyNameTextField); editPanelLeft.add(urlTextField); editPanelLeft.add(telephoneTextField); editPanelLeft.add(percentageLabel); editPanelLeft.add(searchLabel); editPanelLeft.add(new JLabel()); editPanelLeft.add(sortLabel); editPanelLeft.add(percentageTextField); editPanelLeft.add(searchTextField); Container searchBox = Box.createVerticalBox(); searchBox.add(clearSearchButton); editPanelLeft.add(searchBox); editPanelLeft.add(sortComboBox); editPanel.add(editPanelRight, BorderLayout.EAST); Container box = Box.createVerticalBox(); box.add(saveInsuranceCompanyButton); box.add(Box.createVerticalStrut(5)); box.add(addInsuranceCompanyButton); box.add(Box.createVerticalStrut(5)); box.add(deleteInsuranceCompanyButton); editPanelRight.add(box); editPanel.add(editPanelCenter, BorderLayout.SOUTH); editPanelCenter.setLayout(new GridLayout(4, 1)); editPanelCenter.add(insuranceTypesLabel); editPanelCenter.add(insuranceTypesTextField); editPanelCenter.add(generalDescriptionLabel); editPanelCenter.add(generalDescriptionTextField); mainPanel.add(tablePanel, BorderLayout.CENTER); tablePanel.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEmptyBorder(10, 10, 10, 10), "Insurance Companies Overview")); tablePanel.setLayout(new BorderLayout()); tablePanel.add(insuranceCompanyScrollPane, BorderLayout.CENTER); setMinimumSize(new Dimension(800, 600)); setPreferredSize(new Dimension(900, 600)); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pack(); }
private void jbInit() throws Exception { saveButton.setText("Save"); saveButton.addActionListener(new PrintfTemplateEditor_saveButton_actionAdapter(this)); cancelButton.setText("Cancel"); cancelButton.addActionListener(new PrintfTemplateEditor_cancelButton_actionAdapter(this)); this.setTitle(this.getTitle() + " Template Editor"); printfPanel.setLayout(gridBagLayout1); formatLabel.setFont(new java.awt.Font("DialogInput", 0, 12)); formatLabel.setText("Format String:"); buttonPanel.setLayout(flowLayout1); printfPanel.setBorder(BorderFactory.createEtchedBorder()); printfPanel.setMinimumSize(new Dimension(100, 160)); printfPanel.setPreferredSize(new Dimension(380, 160)); parameterPanel.setLayout(gridBagLayout2); parameterLabel.setText("Parameters:"); parameterLabel.setFont(new java.awt.Font("DialogInput", 0, 12)); parameterTextArea.setMinimumSize(new Dimension(100, 25)); parameterTextArea.setPreferredSize(new Dimension(200, 25)); parameterTextArea.setEditable(true); parameterTextArea.setText(""); insertButton.setMaximumSize(new Dimension(136, 20)); insertButton.setMinimumSize(new Dimension(136, 20)); insertButton.setPreferredSize(new Dimension(136, 20)); insertButton.setToolTipText( "insert the format in the format string and add parameter to list."); insertButton.setText("Insert Parameter"); insertButton.addActionListener(new PrintfTemplateEditor_insertButton_actionAdapter(this)); formatTextArea.setMinimumSize(new Dimension(100, 25)); formatTextArea.setPreferredSize(new Dimension(200, 15)); formatTextArea.setText(""); parameterPanel.setBorder(null); parameterPanel.setMinimumSize(new Dimension(60, 40)); parameterPanel.setPreferredSize(new Dimension(300, 40)); insertMatchButton.addActionListener( new PrintfTemplateEditor_insertMatchButton_actionAdapter(this)); insertMatchButton.setText("Insert Match"); insertMatchButton.setToolTipText( "insert the match in the format string and add parameter to list."); insertMatchButton.setPreferredSize(new Dimension(136, 20)); insertMatchButton.setMinimumSize(new Dimension(136, 20)); insertMatchButton.setMaximumSize(new Dimension(136, 20)); matchPanel.setPreferredSize(new Dimension(300, 40)); matchPanel.setBorder(null); matchPanel.setMinimumSize(new Dimension(60, 60)); matchPanel.setLayout(gridBagLayout3); InsertPanel.setLayout(gridLayout1); gridLayout1.setColumns(1); gridLayout1.setRows(2); gridLayout1.setVgap(0); InsertPanel.setBorder(BorderFactory.createEtchedBorder()); InsertPanel.setMinimumSize(new Dimension(100, 100)); InsertPanel.setPreferredSize(new Dimension(380, 120)); editorPane.setText(""); editorPane.addKeyListener(new PrintfEditor_editorPane_keyAdapter(this)); printfTabPane.addChangeListener(new PrintfEditor_printfTabPane_changeAdapter(this)); parameterPanel.add( insertButton, new GridBagConstraints( 1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(8, 6, 13, 8), 0, 10)); parameterPanel.add( paramComboBox, new GridBagConstraints( 0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(8, 8, 13, 0), 258, 11)); paramComboBox.setRenderer(new MyCellRenderer()); InsertPanel.add(matchPanel, null); InsertPanel.add(parameterPanel, null); buttonPanel.add(cancelButton, null); buttonPanel.add(saveButton, null); this.getContentPane().add(printfTabPane, BorderLayout.NORTH); this.getContentPane().add(InsertPanel, BorderLayout.CENTER); matchPanel.add( insertMatchButton, new GridBagConstraints( 1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(8, 6, 13, 8), 0, 10)); matchPanel.add( matchComboBox, new GridBagConstraints( 0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(8, 8, 13, 0), 258, 11)); printfPanel.add( parameterLabel, new GridBagConstraints( 0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(7, 5, 0, 5), 309, 0)); printfPanel.add( formatLabel, new GridBagConstraints( 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(4, 5, 0, 5), 288, 0)); printfPanel.add( formatTextArea, new GridBagConstraints( 0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(6, 5, 0, 5), 300, 34)); printfPanel.add( parameterTextArea, new GridBagConstraints( 0, 3, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(6, 5, 6, 5), 300, 34)); printfTabPane.addTab("Editor View", null, editorPanel, "View in Editor"); printfTabPane.addTab("Printf View", null, printfPanel, "Vies as Printf"); editorPane.setCharacterAttributes(PLAIN_ATTR, true); editorPane.addStyle("PLAIN", editorPane.getLogicalStyle()); editorPanel.getViewport().add(editorPane, null); this.getContentPane().add(buttonPanel, BorderLayout.SOUTH); buttonGroup.add(cancelButton); }
public ThumbMaker() { super("ThumbMaker"); // grab the preferences so that they can be used to fill out the layout ThumbMakerPreferences myPrefs = ThumbMakerPreferences.getInstance(); // content pane JPanel pane = new JPanel(); pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS)); setContentPane(pane); // top panel JPanel top = new JPanel(); top.setLayout(new BoxLayout(top, BoxLayout.X_AXIS)); pane.add(top); // left-hand panel JPanel left = new JPanel(); left.setLayout(new BoxLayout(left, BoxLayout.Y_AXIS)); top.add(left); // horizontal padding top.add(Box.createHorizontalStrut(5)); // label for file list JLabel listLabel = GUIUtil.makeLabel("Files to process:"); listLabel.setDisplayedMnemonic('f'); String listTip = "List of files from which to create thumbnails"; listLabel.setToolTipText(listTip); left.add(GUIUtil.pad(listLabel)); // list of files to convert list = new JList(); listLabel.setLabelFor(list); list.setToolTipText(listTip); list.setModel(new DefaultListModel()); list.setDragEnabled(true); changeFilesInList = new ThumbTransferHandler(); list.setTransferHandler(changeFilesInList); left.add(new JScrollPane(list)); // progress bar progress = new JProgressBar(0, 1); progress.setString("[Drag and drop files onto list to begin]"); progress.setStringPainted(true); progress.setToolTipText("Status of thumbnail processing operation"); left.add(progress); // panel for process and remove buttons JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); // add files button addFiles = new JButton("Add Files"); addFiles.setMnemonic('d'); addFiles.setToolTipText("Add files to be processed."); addFiles.addActionListener(this); p.add(addFiles); p.add(Box.createHorizontalStrut(5)); // process button process = new JButton("Process"); process.setMnemonic('p'); process.setToolTipText("Begin creating thumbnails"); process.addActionListener(this); p.add(process); p.add(Box.createHorizontalStrut(5)); // remove button remove = new JButton("Remove"); remove.setMnemonic('v'); remove.setToolTipText("Remove selected files from the list"); remove.addActionListener(this); p.add(remove); left.add(GUIUtil.pad(p)); // right-hand panel JPanel right = new JPanel(); right.setLayout(new BoxLayout(right, BoxLayout.Y_AXIS)); top.add(right); // panel for resolution settings p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); // resolution label JLabel resLabel = GUIUtil.makeLabel("Resolution: "); resLabel.setDisplayedMnemonic('s'); resLabel.setToolTipText("Resolution of the thumbnails"); p.add(resLabel); // x resolution text box xres = GUIUtil.makeTextField(myPrefs.getStringPref(ThumbMakerPreferences.RES_WIDTH_PREF_NAME), 2); resLabel.setLabelFor(xres); xres.setToolTipText("Thumbnail width"); p.add(xres); // "by" label JLabel byLabel = GUIUtil.makeLabel(" by "); byLabel.setDisplayedMnemonic('y'); p.add(byLabel); // y resolution text box yres = GUIUtil.makeTextField(myPrefs.getStringPref(ThumbMakerPreferences.RES_HEIGHT_PREF_NAME), 2); byLabel.setLabelFor(yres); yres.setToolTipText("Thumbnail height"); p.add(yres); right.add(GUIUtil.pad(p)); right.add(Box.createVerticalStrut(8)); // aspect ratio checkbox aspect = new JCheckBox("Maintain aspect ratio", true); aspect.setMnemonic('m'); aspect.setToolTipText( "When checked, thumbnails are not stretched, " + "but rather padded with the background color."); aspect.addActionListener(this); right.add(GUIUtil.pad(aspect)); // make sure that the check box is initialized correctly aspect.setSelected( myPrefs .getStringPref(ThumbMakerPreferences.DO_MAINTAIN_ASPECT_PREF_NAME) .equalsIgnoreCase(ThumbMakerPreferences.BOOLEAN_TRUE_STRING)); // panel for background color p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); // load the color values from the preferences int redValueNumber = myPrefs.getIntegerPref(ThumbMakerPreferences.RED_VALUE_PREF_NAME); int greenValueNumber = myPrefs.getIntegerPref(ThumbMakerPreferences.GREEN_VALUE_PREF_NAME); int blueValueNumber = myPrefs.getIntegerPref(ThumbMakerPreferences.BLUE_VALUE_PREF_NAME); // background color label colorLabel = GUIUtil.makeLabel("Background color: "); String colorTip = "Thumbnail background color"; colorLabel.setToolTipText(colorTip); p.add(colorLabel); // background color colorBox = new JPanel(); colorBox.setToolTipText(colorTip); colorBox.setBorder(new LineBorder(Color.black, 1)); Dimension colorBoxSize = new Dimension(45, 15); colorBox.setMaximumSize(colorBoxSize); colorBox.setMinimumSize(colorBoxSize); colorBox.setPreferredSize(colorBoxSize); colorBox.setBackground(new Color(redValueNumber, greenValueNumber, blueValueNumber)); p.add(colorBox); right.add(GUIUtil.pad(p)); right.add(Box.createVerticalStrut(2)); // red slider redLabel = GUIUtil.makeLabel("R"); red = new JSlider(0, 255, redValueNumber); redValue = GUIUtil.makeLabel("" + redValueNumber); redValue.setToolTipText("Red color component slider"); right.add(makeSlider(redLabel, red, redValue, "Red")); // green slider greenLabel = GUIUtil.makeLabel("G"); green = new JSlider(0, 255, greenValueNumber); greenValue = GUIUtil.makeLabel("" + greenValueNumber); greenValue.setToolTipText("Green color component slider"); right.add(makeSlider(greenLabel, green, greenValue, "Green")); // blue slider blueLabel = GUIUtil.makeLabel("B"); blue = new JSlider(0, 255, blueValueNumber); blueValue = GUIUtil.makeLabel("" + blueValueNumber); right.add(makeSlider(blueLabel, blue, blueValue, "Blue")); right.add(Box.createVerticalStrut(8)); // panel for algorithm p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); // algorithm label JLabel algorithmLabel = GUIUtil.makeLabel("Algorithm: "); algorithmLabel.setDisplayedMnemonic('l'); String algorithmTip = "Resizing algorithm to use"; algorithmLabel.setToolTipText(algorithmTip); p.add(algorithmLabel); // algorithm combo box algorithm = GUIUtil.makeComboBox( new String[] {"Smooth", "Standard", "Fast", "Replicate", "Area averaging"}); algorithmLabel.setLabelFor(algorithm); algorithm.setToolTipText(algorithmTip); p.add(algorithm); // set the algorithm value from the preferences algorithm.setSelectedIndex(myPrefs.getIntegerPref(ThumbMakerPreferences.RESIZE_ALG_PREF_NAME)); right.add(GUIUtil.pad(p)); // panel for output format p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); // format label JLabel formatLabel = GUIUtil.makeLabel("Format: "); formatLabel.setDisplayedMnemonic('f'); String formatTip = "Thumbnail output format"; formatLabel.setToolTipText(formatTip); p.add(formatLabel); // format combo box format = GUIUtil.makeComboBox(new String[] {"PNG", "JPG"}); formatLabel.setLabelFor(format); format.setToolTipText(formatTip); p.add(format); // set the format value from the preferences format.setSelectedIndex(myPrefs.getIntegerPref(ThumbMakerPreferences.THUMB_FORMAT_PREF_NAME)); right.add(GUIUtil.pad(p)); right.add(Box.createVerticalStrut(5)); // panel for prepend string p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); // prepend label JLabel prependLabel = GUIUtil.makeLabel("Prepend: "); prependLabel.setDisplayedMnemonic('e'); String prependTip = "Starting string for each thumbnail filename"; prependLabel.setToolTipText(prependTip); p.add(prependLabel); // prepend field prepend = GUIUtil.makeTextField( myPrefs.getStringPref(ThumbMakerPreferences.STRING_TO_PREPEND_PREF_NAME), 4); prependLabel.setLabelFor(prepend); prepend.setToolTipText(prependTip); p.add(prepend); p.add(Box.createHorizontalStrut(5)); // append label JLabel appendLabel = GUIUtil.makeLabel("Append: "); appendLabel.setDisplayedMnemonic('a'); String appendTip = "Ending string for each thumbnail filename"; appendLabel.setToolTipText(appendTip); p.add(appendLabel); // append field append = GUIUtil.makeTextField( myPrefs.getStringPref(ThumbMakerPreferences.STRING_TO_APPEND_PREF_NAME), 4); appendLabel.setLabelFor(append); append.setToolTipText(appendTip); p.add(append); right.add(GUIUtil.pad(p)); // vertical padding right.add(Box.createVerticalGlue()); // bottom panel JPanel bottom = new JPanel(); bottom.setLayout(new BoxLayout(bottom, BoxLayout.X_AXIS)); pane.add(bottom); // output folder label JLabel outputLabel = GUIUtil.makeLabel("Output folder: "); outputLabel.setDisplayedMnemonic('o'); String outputTip = "Thumbnail output folder"; outputLabel.setToolTipText(outputTip); bottom.add(outputLabel); // output folder field String filePath = new File(myPrefs.getStringPref(ThumbMakerPreferences.FILE_PATH_STRING_PREF_NAME)) .getAbsolutePath(); output = GUIUtil.makeTextField(filePath, 8); outputLabel.setLabelFor(output); output.setToolTipText(outputTip); // start this in default and then lock down so "..." is used output.setEditable(false); output.setBackground(Color.LIGHT_GRAY); bottom.add(output); // add a file chooser button "..." dotDotDot = new JButton("..."); dotDotDot.setMnemonic('.'); dotDotDot.setToolTipText("Select destination directory."); dotDotDot.addActionListener(this); bottom.add(dotDotDot); right.add(GUIUtil.pad(p)); setFromPreferences(); addWindowListener(this); }
/** Initializes the graphical components */ public void init() { username = getParameter("username"); if (username == null) { username = JOptionPane.showInputDialog( this, "Please enter a username", "Login", JOptionPane.QUESTION_MESSAGE); } try { PORT = Integer.valueOf(getParameter("port")).intValue(); } catch (NumberFormatException e) { PORT = 42412; } URL url = getDocumentBase(); site = url.getHost(); locationURL = "http://" + site + ":" + url.getPort() + "/" + url.getPath(); setSize(615, 362); c = getContentPane(); c.setBackground(new Color(224, 224, 224)); if (site == null || locationURL == null) { c.add(new JLabel("ERROR: did not recieve needed data from page")); } myAction = new MyAction(); myKeyListener = new MyKeyListener(); myMouseListener = new MyMouseListener(); myHyperlinkListener = new MyHyperlinkListener(); c.setLayout(null); cboChannels = new JComboBox(); cboChannels.setBounds(5, 5, 150, 24); butChannel = new JButton("Join"); butChannel.setToolTipText("Join channel"); butChannel.addActionListener(myAction); butChannel.setBounds(160, 5, 60, 24); butCreate = new JButton("Create"); butCreate.setToolTipText("Create new channel"); butCreate.addActionListener(myAction); butCreate.setBounds(230, 5, 100, 24); butCreate.setEnabled(false); butInvite = new JButton("Invite"); butInvite.setToolTipText("Invite Friend"); butInvite.addActionListener(myAction); butInvite.setBounds(340, 5, 80, 24); mainChat = new ChatPane(this); textScroller = new JScrollPane( mainChat, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); textScroller.setBounds(5, 34, 500, 270); userList = new JList(); userList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); userList.setCellRenderer(new MyCellRenderer()); userList.setBackground(new Color(249, 249, 250)); JScrollPane userScroller = new JScrollPane(userList); userScroller.setBounds(510, 34, 100, 297); messageText = new JTextField(); messageText.setBounds(5, 309, 500, 22); messageText.setColumns(10); messageText.setBackground(new Color(249, 249, 250)); JMenuItem item; popup = new JPopupMenu("test"); popup.add("whisper").addActionListener(myAction); popup.add("private message").addActionListener(myAction); popup.add("ignore").addActionListener(myAction); popup.add("clear ignore list").addActionListener(myAction); conNo = new ImageIcon(getURL("images/connect_no.gif")); conYes = new ImageIcon(getURL("images/connect_established.gif")); secNo = new ImageIcon(getURL("images/decrypted.gif")); secYes = new ImageIcon(getURL("images/encrypted.gif")); conIcon = new JLabel(conNo); conIcon.setBorder(new EtchedBorder()); secIcon = new JLabel(secNo); secIcon.setBorder(new EtchedBorder()); conIcon.setBounds(563, 334, 22, 22); secIcon.setBounds(588, 334, 22, 22); bottomText = new JLabel( "<html><body><font color=#445577><b>" + "LlamaChat " + VERSION + "</b></font> © " + "<a href=\"" + linkURL + "\">Joseph Monti</a> 2002-2003" + "</body></html>"); bottomText.setBounds(5, 336, 500, 20); c.add(cboChannels); c.add(butChannel); c.add(butCreate); c.add(butInvite); c.add(textScroller); c.add(userScroller); c.add(messageText); c.add(conIcon); c.add(secIcon); c.add(bottomText); userList.addMouseListener(myMouseListener); messageText.addKeyListener(myKeyListener); bottomText.addMouseListener(myMouseListener); users = new ArrayList(); ignores = new ArrayList(5); afks = new ArrayList(5); admins = new ArrayList(5); history = new CommandHistory(10); admin = false; channels = new Hashtable(); privates = new PrivateMsg(this); showUserStatus = false; myColors[0] = new Color(200, 0, 0); myColors[1] = new Color(0, 150, 0); myColors[2] = new Color(0, 0, 200); rect = new Rectangle(0, 0, 1, 1); String opening = "<font color=#333333>" + "==================================<br>" + "Welcome to LlamaChat " + VERSION + "<br>" + "If you need assistance, type \\help<br>" + "Enjoy your stay!<br>" + "Maestria Aplicada en Redes<br>" + "==================================<br></font>"; HTMLDocument doc = (HTMLDocument) mainChat.getDocument(); HTMLEditorKit kit = (HTMLEditorKit) mainChat.getEditorKit(); try { kit.insertHTML(doc, doc.getLength(), opening, 0, 0, HTML.Tag.FONT); } catch (Throwable t) { t.printStackTrace(System.out); } // validate the name if (!username.matches("[\\w_-]+?")) { error( "username contains invalid characters, changing to " + "'invalid' for now. " + "Type \\rename to chose a new name"); username = "******"; } if (username.length() > 10) { username = username.substring(0, 10); error("username too long, changed to " + username); } connect(); }
/** * Create and return the Gui contents. * * @return The gui contents. */ protected JComponent doMakeContents() { // dataSelector = new DataSelector(getIdv(), new Dimension(400, 200), // true); // Get the list of catalogs but remove the old catalog.xml entry urlListHandler = getPreferenceList(PREF_CATALOGLIST); final XmlChooser xmlChooser = this; ActionListener catListListener = new ActionListener() { public void actionPerformed(ActionEvent ae) { if (!okToDoUrlListEvents) { return; } xmlChooser.actionPerformed(ae); } }; urlBox = urlListHandler.createComboBox(GuiUtils.CMD_UPDATE, catListListener, true); GuiUtils.setPreferredWidth(urlBox, 200); // top panel JButton browseButton = new JButton("Select File..."); browseButton.setToolTipText("Choose a catalog from disk"); browseButton.setActionCommand(CMD_BROWSE); browseButton.addActionListener(this); GuiUtils.setHFill(); JPanel catListPanel = GuiUtils.doLayout(new Component[] {urlBox}, 1, GuiUtils.WT_Y, GuiUtils.WT_N); backBtn = GuiUtils.getImageButton(GuiUtils.getImageIcon("/auxdata/ui/icons/Left16.gif", getClass())); backBtn.setToolTipText("View previous selection"); GuiUtils.makeMouseOverBorder(backBtn); backBtn.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { goBack(); } }); fwdBtn = GuiUtils.getImageButton(GuiUtils.getImageIcon("/auxdata/ui/icons/Right16.gif", getClass())); GuiUtils.makeMouseOverBorder(fwdBtn); fwdBtn.setToolTipText("View next selection"); fwdBtn.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { goForward(); } }); checkButtons(); JComponent bottomButtons = getDefaultButtons(); handlerHolder = new JPanel(); handlerHolder.setLayout(new BorderLayout()); // JPanel tmp = new JPanel(); // tmp.setPreferredSize(new Dimension(200,500)); // handlerHolder.add(tmp, BorderLayout.CENTER); if (getIdv().getArgsManager().getInitCatalogs().size() > 0) { initialUrlPath = (String) getIdv().getArgsManager().getInitCatalogs().get(0); urlBox.setSelectedItem(initialUrlPath); } else { if ((initialUrlPath != null) && (initialUrlPath.length() > 0)) { makeUiFromPath(initialUrlPath); } else { makeBlankTree(); } } JPanel navButtons = GuiUtils.hbox(backBtn, fwdBtn); GuiUtils.tmpInsets = GRID_INSETS; JPanel catPanel = GuiUtils.doLayout( new Component[] {new JLabel("Catalogs:"), catListPanel, browseButton}, 3, GuiUtils.WT_NYN, GuiUtils.WT_N); JPanel topPanel = GuiUtils.leftCenter(navButtons, catPanel); myContents = GuiUtils.topCenterBottom(topPanel, handlerHolder, bottomButtons); // myContents = GuiUtils.topCenter(getStatusComponent(), myContents); return myContents; }
/** * Constructor that takes a MoviePlayer as a parameter. * * @param player the MoviePlayer object */ public ButtonPanel(MoviePlayer player) { this.moviePlayer = player; // add the previous and next buttons to this panel this.add(prevButton); this.add(nextButton); // set up the frame rate list frameRateLabel = new JLabel("Frames per Second: "); this.add(frameRateLabel); String[] rates = {"16", "24", "30"}; frameRateList = new JList(rates); JScrollPane scrollPane = new JScrollPane(frameRateList); frameRateList.setSelectedIndex(0); frameRateList.setVisibleRowCount(1); frameRateList.setToolTipText("The number of frames per second in the movie"); frameRateList.addListSelectionListener( new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { String rateS = (String) frameRateList.getSelectedValue(); int rate = Integer.parseInt(rateS); moviePlayer.setFrameRate(rate); } }); this.add(scrollPane); this.add(playButton); this.add(delBeforeButton); this.add(delAfterButton); this.add(writeQuicktimeButton); this.add(writeAVIButton); // add the action listeners to the buttons nextButton.setToolTipText("Click to see the next frame"); nextButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { moviePlayer.showNext(); } }); prevButton.setToolTipText("Click to see the previous frame"); prevButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { moviePlayer.showPrevious(); } }); playButton.setToolTipText("Click to play the movie"); playButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { moviePlayer.playMovie(); } }); delBeforeButton.setToolTipText("Click to delete all frames before the current one"); delBeforeButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { moviePlayer.delAllBefore(); } }); delAfterButton.setToolTipText("Click to delete all frames after the current one"); delAfterButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { moviePlayer.delAllAfter(); } }); writeQuicktimeButton.setToolTipText("Click to write out a Quicktime movie from the frames"); writeQuicktimeButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { moviePlayer.writeQuicktime(); } }); writeAVIButton.setToolTipText("Click to write out an AVI movie from the frames"); writeAVIButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { moviePlayer.writeAVI(); } }); }
/** * Show the results sent to a batch queue. * * @param mysettings jemboss settings * @param epr pending results * @throws JembossSoapException when server connection fails */ public ShowSavedResults(final JembossParams mysettings, final PendingResults epr) throws JembossSoapException { this("Current Sessions Results"); Dimension d = new Dimension(270, 100); ss.setPreferredSize(d); // ss.setMaximumSize(d); JMenu resFileMenu = new JMenu("File"); resMenu.add(resFileMenu); JButton refresh = new JButton(rfii); refresh.setMargin(new Insets(0, 1, 0, 1)); refresh.setToolTipText("Refresh"); resMenu.add(refresh); refresh.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { setCursor(cbusy); epr.updateStatus(); setCursor(cdone); datasets.removeAllElements(); Enumeration enumer = epr.descriptionHash().keys(); while (enumer.hasMoreElements()) { String image = convertToPretty((String) enumer.nextElement()); datasets.addElement(image); } } }); JMenuItem resFileMenuExit = new JMenuItem("Close"); resFileMenuExit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E, ActionEvent.CTRL_MASK)); resFileMenuExit.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { dispose(); } }); resFileMenu.add(resFileMenuExit); setJMenuBar(resMenu); // set up the results list in the gui Enumeration enumer = epr.descriptionHash().keys(); while (enumer.hasMoreElements()) datasets.addElement(convertToPretty((String) enumer.nextElement())); final JList st = new JList(datasets); st.setCellRenderer(new TabListCellRenderer()); st.addListSelectionListener( new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting()) return; JList theList = (JList) e.getSource(); if (!theList.isSelectionEmpty()) { int index = theList.getSelectedIndex(); String thisdata = convertToOriginal(datasets.elementAt(index)); aboutRes.setText((String) epr.descriptionHash().get(thisdata)); aboutRes.setCaretPosition(0); aboutRes.setEditable(false); } } }); st.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { try { setCursor(cbusy); String project = convertToOriginal(st.getSelectedValue()); ResultList thisres = new ResultList(mysettings, project, "show_saved_results"); setCursor(cdone); if (thisres.getStatus().equals("0")) new ShowResultSet(thisres.hash(), project, mysettings); else JOptionPane.showMessageDialog( null, thisres.getStatusMsg(), "Soap Error", JOptionPane.ERROR_MESSAGE); } catch (JembossSoapException eae) { AuthPopup ap = new AuthPopup(mysettings, null); ap.setBottomPanel(); ap.setSize(380, 170); ap.pack(); ap.setVisible(true); } } } }); sp.add(st); // display retrieves all the files and shows them in a window JPanel resButtonPanel = new JPanel(); JButton showResButton = new JButton("Display"); showResButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if (st.getSelectedValue() != null) { try { setCursor(cbusy); String project = convertToOriginal(st.getSelectedValue()); ResultList thisres = new ResultList(mysettings, project, "show_saved_results"); setCursor(cdone); if (thisres.getStatus().equals("0")) new ShowResultSet(thisres.hash(), project, mysettings); else JOptionPane.showMessageDialog( null, thisres.getStatusMsg(), "Soap Error", JOptionPane.ERROR_MESSAGE); } catch (JembossSoapException eae) { setCursor(cdone); AuthPopup ap = new AuthPopup(mysettings, null); ap.setBottomPanel(); ap.setSize(380, 170); ap.pack(); ap.setVisible(true); } } } }); // delete removes the file on the server and edits the list JButton delResButton = new JButton("Delete"); delResButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { Object sel[] = st.getSelectedValues(); if (sel != null) { String selList = new String(""); for (int i = 0; i < sel.length; i++) selList = selList.concat(sel[i] + "\n"); int ok = JOptionPane.OK_OPTION; if (sel.length > 1) ok = JOptionPane.showConfirmDialog( null, "Delete the following results:\n" + selList, "Confirm Deletion", JOptionPane.YES_NO_OPTION); if (ok == JOptionPane.OK_OPTION) { try { setCursor(cbusy); selList = convertToOriginal(selList); new ResultList(mysettings, selList, "delete_saved_results"); setCursor(cdone); for (int i = 0; i < sel.length; i++) { JembossProcess jp = epr.getResult(convertToOriginal(sel[i])); epr.removeResult(jp); datasets.removeElement(sel[i]); // amend the list } statusField.setText("Deleted " + sel.length + " result(s)"); aboutRes.setText(""); st.setSelectedIndex(-1); } catch (JembossSoapException eae) { // shouldn't happen AuthPopup ap = new AuthPopup(mysettings, null); ap.setBottomPanel(); ap.setSize(380, 170); ap.pack(); ap.setVisible(true); } } } } }); resButtonPanel.add(delResButton); resButtonPanel.add(showResButton); resButtonStatus.add(resButtonPanel, BorderLayout.CENTER); resButtonStatus.add(statusField, BorderLayout.SOUTH); Container c = getContentPane(); c.add(ss, BorderLayout.WEST); c.add(aboutScroll, BorderLayout.CENTER); c.add(resButtonStatus, BorderLayout.SOUTH); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); pack(); setVisible(true); // add in automatic updates String freq = (String) AdvancedOptions.jobMgr.getSelectedItem(); int ind = freq.indexOf(" "); new ResultsUpdateTimer(Integer.parseInt(freq.substring(0, ind)), datasets, this); statusField.setText("Window refresh rate " + freq); }
/** * Show the saved results on the server. * * @param mysettings jemboss settings * @param frameName title name for frame */ public ShowSavedResults(final JembossParams mysettings, final JFrame f) { this("Saved results list" + (Jemboss.withSoap ? " on server" : "")); try { final ResultList reslist = new ResultList(mysettings); JMenu resFileMenu = new JMenu("File"); resMenu.add(resFileMenu); final JCheckBoxMenuItem listByProgram = new JCheckBoxMenuItem("List by program"); listByProgram.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { listByProgramName(); } }); resFileMenu.add(listByProgram); JCheckBoxMenuItem listByDate = new JCheckBoxMenuItem("List by date", true); listByDate.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { listByDateRun(reslist, false); } }); resFileMenu.add(listByDate); ButtonGroup group = new ButtonGroup(); group.add(listByProgram); group.add(listByDate); JButton refresh = new JButton(rfii); refresh.setMargin(new Insets(0, 1, 0, 1)); refresh.setToolTipText("Refresh"); resMenu.add(refresh); refresh.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { setCursor(cbusy); ResultList newlist = new ResultList(mysettings); setCursor(cdone); if (newlist.getStatus().equals("0")) { reslist.updateRes(newlist.hash()); datasets.removeAllElements(); StringTokenizer tok = new StringTokenizer((String) reslist.get("list"), "\n"); while (tok.hasMoreTokens()) datasets.addElement(convertToPretty(tok.nextToken())); if (listByProgram.isSelected()) listByProgramName(); else listByDateRun(reslist, false); } else { JOptionPane.showMessageDialog( null, newlist.getStatusMsg(), "Soap Error", JOptionPane.ERROR_MESSAGE); } } catch (JembossSoapException eae) { AuthPopup ap = new AuthPopup(mysettings, f); ap.setBottomPanel(); ap.setSize(380, 170); ap.pack(); ap.setVisible(true); } } }); resFileMenu.addSeparator(); JMenuItem resFileMenuExit = new JMenuItem("Close"); resFileMenuExit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E, ActionEvent.CTRL_MASK)); resFileMenuExit.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { dispose(); } }); resFileMenu.add(resFileMenuExit); setJMenuBar(resMenu); // this is the list of saved results listByDateRun(reslist, true); final JList st = new JList(datasets); st.setCellRenderer(new TabListCellRenderer()); st.addListSelectionListener( new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting()) return; JList theList = (JList) e.getSource(); if (theList.isSelectionEmpty()) { System.out.println("Empty selection"); } else { int index = theList.getSelectedIndex(); String thisdata = convertToOriginal(datasets.elementAt(index)); aboutRes.setText((String) reslist.get(thisdata)); aboutRes.setCaretPosition(0); } } }); st.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { try { setCursor(cbusy); String project = convertToOriginal(st.getSelectedValue()); ResultList thisres = new ResultList(mysettings, project, "show_saved_results"); new ShowResultSet(thisres.hash(), project, mysettings); setCursor(cdone); } catch (JembossSoapException eae) { AuthPopup ap = new AuthPopup(mysettings, f); ap.setBottomPanel(); ap.setSize(380, 170); ap.pack(); ap.setVisible(true); } } } }); sp.add(st); // display retrieves all files and shows them in a window JPanel resButtonPanel = new JPanel(); JButton showResButton = new JButton("Display"); showResButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { String sel = convertToOriginal(st.getSelectedValue()); if (sel != null) { try { setCursor(cbusy); ResultList thisres = new ResultList(mysettings, sel, "show_saved_results"); if (thisres.hash().size() == 0) JOptionPane.showMessageDialog( sp, "This application launch '" + sel + "' didn't produce any result files."); else new ShowResultSet(thisres.hash(), sel, mysettings); setCursor(cdone); } catch (JembossSoapException eae) { AuthPopup ap = new AuthPopup(mysettings, f); ap.setBottomPanel(); ap.setSize(380, 170); ap.pack(); ap.setVisible(true); } } else { statusField.setText("Nothing selected to be displayed."); } } }); // add a users note for that project JButton addNoteButton = new JButton("Edit Notes"); addNoteButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { String sel = convertToOriginal(st.getSelectedValue()); if (sel != null) { try { setCursor(cbusy); ResultList thisres = new ResultList(mysettings, sel, "Notes", "show_saved_results"); new ShowResultSet(thisres.hash(), sel, mysettings); setCursor(cdone); } catch (JembossSoapException eae) { AuthPopup ap = new AuthPopup(mysettings, f); ap.setBottomPanel(); ap.setSize(380, 170); ap.pack(); ap.setVisible(true); } } else { statusField.setText("Selected a project!"); } } }); // delete removes the file on the server & edits the list JButton delResButton = new JButton("Delete"); delResButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { Object sel[] = st.getSelectedValues(); if (sel != null) { String selList = new String(""); JTextPane delList = new JTextPane(); FontMetrics fm = delList.getFontMetrics(delList.getFont()); int maxWidth = 0; for (int i = 0; i < sel.length; i++) { if (i == sel.length - 1) selList = selList.concat((String) sel[i]); else selList = selList.concat(sel[i] + "\n"); int width = fm.stringWidth((String) sel[i]); if (width > maxWidth) maxWidth = width; } int ok = JOptionPane.OK_OPTION; if (sel.length > 1) { JScrollPane scrollDel = new JScrollPane(delList); delList.setText(selList); delList.setEditable(false); delList.setCaretPosition(0); Dimension d1 = delList.getPreferredSize(); int maxHeight = (int) d1.getHeight() + 5; if (maxHeight > 350) maxHeight = 350; else if (maxHeight < 50) maxHeight = 50; scrollDel.setPreferredSize(new Dimension(maxWidth + 30, maxHeight)); ok = JOptionPane.showConfirmDialog( null, scrollDel, "Confirm Deletion", JOptionPane.YES_NO_OPTION); } if (ok == JOptionPane.OK_OPTION) { try // ask the server to delete these results { setCursor(cbusy); selList = convertToOriginal(selList); new ResultList(mysettings, selList, "delete_saved_results"); setCursor(cdone); // amend the list for (int i = 0; i < sel.length; i++) datasets.removeElement(sel[i]); statusField.setText("Deleted " + sel.length + " result(s)"); aboutRes.setText(""); st.setSelectedIndex(-1); } catch (JembossSoapException eae) { AuthPopup ap = new AuthPopup(mysettings, f); ap.setBottomPanel(); ap.setSize(380, 170); ap.pack(); ap.setVisible(true); } } } else { statusField.setText("Nothing selected for deletion."); } } }); resButtonPanel.add(delResButton); resButtonPanel.add(addNoteButton); resButtonPanel.add(showResButton); resButtonStatus.add(resButtonPanel, BorderLayout.CENTER); resButtonStatus.add(statusField, BorderLayout.SOUTH); Container c = getContentPane(); c.add(ss, BorderLayout.WEST); c.add(aboutScroll, BorderLayout.CENTER); c.add(resButtonStatus, BorderLayout.SOUTH); pack(); setVisible(true); } catch (JembossSoapException eae) { AuthPopup ap = new AuthPopup(mysettings, f); ap.setBottomPanel(); ap.setSize(380, 170); ap.pack(); ap.setVisible(true); } }
public void installComponents(JFileChooser fc) { fc.setLayout(new BorderLayout(10, 10)); fc.setAlignmentX(JComponent.CENTER_ALIGNMENT); JPanel interior = new JPanel() { public Insets getInsets() { return insets; } }; align(interior); interior.setLayout(new BoxLayout(interior, BoxLayout.PAGE_AXIS)); fc.add(interior, BorderLayout.CENTER); // PENDING(jeff) - I18N JLabel l = new JLabel(pathLabelText); l.setDisplayedMnemonic(pathLabelMnemonic); align(l); interior.add(l); File currentDirectory = fc.getCurrentDirectory(); String curDirName = null; if (currentDirectory != null) { curDirName = currentDirectory.getPath(); } pathField = new JTextField(curDirName) { public Dimension getMaximumSize() { Dimension d = super.getMaximumSize(); d.height = getPreferredSize().height; return d; } }; l.setLabelFor(pathField); align(pathField); // Change to folder on return pathField.addActionListener(getUpdateAction()); interior.add(pathField); interior.add(Box.createRigidArea(vstrut10)); // CENTER: left, right accessory JPanel centerPanel = new JPanel(); centerPanel.setLayout(new BoxLayout(centerPanel, BoxLayout.LINE_AXIS)); align(centerPanel); // left panel - Filter & folderList JPanel leftPanel = new JPanel(); leftPanel.setLayout(new BoxLayout(leftPanel, BoxLayout.PAGE_AXIS)); align(leftPanel); // add the filter PENDING(jeff) - I18N l = new JLabel(filterLabelText); l.setDisplayedMnemonic(filterLabelMnemonic); align(l); leftPanel.add(l); filterComboBox = new JComboBox() { public Dimension getMaximumSize() { Dimension d = super.getMaximumSize(); d.height = getPreferredSize().height; return d; } }; l.setLabelFor(filterComboBox); filterComboBoxModel = createFilterComboBoxModel(); filterComboBox.setModel(filterComboBoxModel); filterComboBox.setRenderer(createFilterComboBoxRenderer()); fc.addPropertyChangeListener(filterComboBoxModel); align(filterComboBox); leftPanel.add(filterComboBox); // leftPanel.add(Box.createRigidArea(vstrut10)); // Add the Folder List PENDING(jeff) - I18N l = new JLabel(foldersLabelText); l.setDisplayedMnemonic(foldersLabelMnemonic); align(l); leftPanel.add(l); JScrollPane sp = createDirectoryList(); sp.getVerticalScrollBar().setFocusable(false); sp.getHorizontalScrollBar().setFocusable(false); l.setLabelFor(sp.getViewport().getView()); leftPanel.add(sp); // create files list JPanel rightPanel = new JPanel(); align(rightPanel); rightPanel.setLayout(new BoxLayout(rightPanel, BoxLayout.PAGE_AXIS)); l = new JLabel(filesLabelText); l.setDisplayedMnemonic(filesLabelMnemonic); align(l); rightPanel.add(l); sp = createFilesList(); l.setLabelFor(sp); rightPanel.add(sp); centerPanel.add(leftPanel); centerPanel.add(Box.createRigidArea(hstrut10)); centerPanel.add(rightPanel); JComponent accessoryPanel = getAccessoryPanel(); JComponent accessory = fc.getAccessory(); if (accessoryPanel != null) { if (accessory == null) { accessoryPanel.setPreferredSize(ZERO_ACC_SIZE); accessoryPanel.setMaximumSize(ZERO_ACC_SIZE); } else { getAccessoryPanel().add(accessory, BorderLayout.CENTER); accessoryPanel.setPreferredSize(PREF_ACC_SIZE); accessoryPanel.setMaximumSize(MAX_SIZE); } align(accessoryPanel); centerPanel.add(accessoryPanel); } interior.add(centerPanel); interior.add(Box.createRigidArea(vstrut10)); // add the filename field PENDING(jeff) - I18N l = new JLabel(enterFileNameLabelText); l.setDisplayedMnemonic(enterFileNameLabelMnemonic); align(l); interior.add(l); filenameTextField = new JTextField() { public Dimension getMaximumSize() { Dimension d = super.getMaximumSize(); d.height = getPreferredSize().height; return d; } }; l.setLabelFor(filenameTextField); filenameTextField.addActionListener(getApproveSelectionAction()); align(filenameTextField); filenameTextField.setAlignmentX(JComponent.LEFT_ALIGNMENT); interior.add(filenameTextField); bottomPanel = getBottomPanel(); bottomPanel.add(new JSeparator(), BorderLayout.NORTH); // Add buttons JPanel buttonPanel = new JPanel(); align(buttonPanel); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS)); buttonPanel.add(Box.createGlue()); approveButton = new JButton(getApproveButtonText(fc)) { public Dimension getMaximumSize() { return new Dimension(MAX_SIZE.width, this.getPreferredSize().height); } }; approveButton.setMnemonic(getApproveButtonMnemonic(fc)); approveButton.setToolTipText(getApproveButtonToolTipText(fc)); align(approveButton); approveButton.setMargin(buttonMargin); approveButton.addActionListener(getApproveSelectionAction()); buttonPanel.add(approveButton); buttonPanel.add(Box.createGlue()); JButton updateButton = new JButton(updateButtonText) { public Dimension getMaximumSize() { return new Dimension(MAX_SIZE.width, this.getPreferredSize().height); } }; updateButton.setMnemonic(updateButtonMnemonic); updateButton.setToolTipText(updateButtonToolTipText); align(updateButton); updateButton.setMargin(buttonMargin); updateButton.addActionListener(getUpdateAction()); buttonPanel.add(updateButton); buttonPanel.add(Box.createGlue()); JButton cancelButton = new JButton(cancelButtonText) { public Dimension getMaximumSize() { return new Dimension(MAX_SIZE.width, this.getPreferredSize().height); } }; cancelButton.setMnemonic(cancelButtonMnemonic); cancelButton.setToolTipText(cancelButtonToolTipText); align(cancelButton); cancelButton.setMargin(buttonMargin); cancelButton.addActionListener(getCancelSelectionAction()); buttonPanel.add(cancelButton); buttonPanel.add(Box.createGlue()); JButton helpButton = new JButton(helpButtonText) { public Dimension getMaximumSize() { return new Dimension(MAX_SIZE.width, this.getPreferredSize().height); } }; helpButton.setMnemonic(helpButtonMnemonic); helpButton.setToolTipText(helpButtonToolTipText); align(helpButton); helpButton.setMargin(buttonMargin); helpButton.setEnabled(false); buttonPanel.add(helpButton); buttonPanel.add(Box.createGlue()); bottomPanel.add(buttonPanel, BorderLayout.SOUTH); if (fc.getControlButtonsAreShown()) { fc.add(bottomPanel, BorderLayout.SOUTH); } }