List of usage examples for javax.swing BorderFactory createEmptyBorder
public static Border createEmptyBorder(int top, int left, int bottom, int right)
From source file:com.eviware.soapui.support.log.JLogList.java
public JLogList(String title) { super(new BorderLayout()); this.title = title; model = new LogListModel(); logList = new JList(model); logList.setToolTipText(title);//from w ww. j a v a 2s. c o m logList.setCellRenderer(new LogAreaCellRenderer()); logList.setPrototypeCellValue("Testing 123"); logList.setFixedCellWidth(-1); JPopupMenu listPopup = new JPopupMenu(); listPopup.add(new ClearAction()); enableAction = new EnableAction(); enableMenuItem = new JCheckBoxMenuItem(enableAction); enableMenuItem.setSelected(true); listPopup.add(enableMenuItem); listPopup.addSeparator(); listPopup.add(new CopyAction()); listPopup.add(new SetMaxRowsAction()); listPopup.addSeparator(); listPopup.add(new ExportToFileAction()); logList.setComponentPopupMenu(listPopup); setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); JScrollPane scrollPane = new JScrollPane(logList); UISupport.addPreviewCorner(scrollPane, true); add(scrollPane, BorderLayout.CENTER); requestAttributes = new SimpleAttributeSet(); StyleConstants.setForeground(requestAttributes, Color.BLUE); responseAttributes = new SimpleAttributeSet(); StyleConstants.setForeground(responseAttributes, Color.GREEN); try { maxRows = Long.parseLong(SoapUI.getSettings().getString("JLogList#" + title, "1000")); } catch (NumberFormatException e) { } }
From source file:IconDemoApplet.java
public void init() { //Parse the applet parameters pictures = parseParameters();//from w ww. j a v a 2 s .c om //If the applet tag doesn't provide an "IMAGE0" parameter, //display an error message. if (pictures.size() == 0) { captionLabel = new JLabel("No images listed in applet tag."); captionLabel.setHorizontalAlignment(JLabel.CENTER); getContentPane().add(captionLabel); return; } //NOW CREATE THE GUI COMPONENTS //A label to identify XX of XX. numberLabel = new JLabel("Picture " + (current + 1) + " of " + pictures.size()); numberLabel.setHorizontalAlignment(JLabel.LEFT); numberLabel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 5)); //A label for the caption. final Photo first = (Photo) pictures.firstElement(); captionLabel = new JLabel(first.caption); captionLabel.setHorizontalAlignment(JLabel.CENTER); captionLabel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); //A label for displaying the photographs. photographLabel = new JLabel("Loading first image..."); photographLabel.setHorizontalAlignment(JLabel.CENTER); photographLabel.setVerticalAlignment(JLabel.CENTER); photographLabel.setVerticalTextPosition(JLabel.CENTER); photographLabel.setHorizontalTextPosition(JLabel.CENTER); photographLabel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLoweredBevelBorder(), BorderFactory.createEmptyBorder(5, 5, 5, 5))); photographLabel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0), photographLabel.getBorder())); //Set the preferred size for the picture, //with room for the borders. Insets i = photographLabel.getInsets(); photographLabel.setPreferredSize( new Dimension(widthOfWidest + i.left + i.right, heightOfTallest + i.bottom + i.top)); //Create the next and previous buttons. ImageIcon nextIcon = new ImageIcon(getURL(imagedir + "right.gif")); ImageIcon dimmedNextIcon = new ImageIcon(getURL(imagedir + "dimmedRight.gif")); ImageIcon previousIcon = new ImageIcon(getURL(imagedir + "left.gif")); ImageIcon dimmedPreviousIcon = new ImageIcon(getURL(imagedir + "dimmedLeft.gif")); previousButton = new JButton("Previous Picture", previousIcon); previousButton.setDisabledIcon(dimmedPreviousIcon); previousButton.setVerticalTextPosition(AbstractButton.CENTER); previousButton.setHorizontalTextPosition(AbstractButton.RIGHT); previousButton.setMnemonic(KeyEvent.VK_P); previousButton.setActionCommand("previous"); previousButton.addActionListener(this); previousButton.setEnabled(false); nextButton = new JButton("Next Picture", nextIcon); nextButton.setDisabledIcon(dimmedNextIcon); nextButton.setVerticalTextPosition(AbstractButton.CENTER); nextButton.setHorizontalTextPosition(AbstractButton.LEFT); nextButton.setMnemonic(KeyEvent.VK_N); nextButton.setActionCommand("next"); nextButton.addActionListener(this); //Lay out the GUI. GridBagLayout layout = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); Container contentPane = getContentPane(); contentPane.setLayout(layout); c.gridwidth = GridBagConstraints.REMAINDER; c.fill = GridBagConstraints.HORIZONTAL; layout.setConstraints(numberLabel, c); contentPane.add(numberLabel); layout.setConstraints(captionLabel, c); contentPane.add(captionLabel); c.gridwidth = GridBagConstraints.REMAINDER; c.fill = GridBagConstraints.BOTH; layout.setConstraints(photographLabel, c); contentPane.add(photographLabel); c.gridwidth = GridBagConstraints.RELATIVE; c.fill = GridBagConstraints.HORIZONTAL; layout.setConstraints(previousButton, c); contentPane.add(previousButton); c.gridwidth = GridBagConstraints.REMAINDER; layout.setConstraints(nextButton, c); contentPane.add(nextButton); //Start loading the image for the first photograph now. //The loadImage method uses a SwingWorker //to load the image in a separate thread. loadImage(imagedir + first.filename, current); }
From source file:edu.cornell.mannlib.vitro.webapp.imageprocessor.jai.JaiImageProcessorTester2.java
private Component createImagePanel(CropData cropData) { RenderedOp image = createCroppedImage(cropData); Set<String> blackSides = checkBlackEdges(image); if (!blackSides.isEmpty()) { log.warn("edges at " + cropData + ", " + blackSides); }/*from w w w . j ava 2 s . c o m*/ String legend = "left=" + cropData.left + ", top=" + cropData.top + ", size=" + cropData.size; Label l = new Label(); l.setAlignment(Label.CENTER); if (!blackSides.isEmpty()) { l.setBackground(new Color(0xFFDDDD)); legend += " " + blackSides; } l.setText(legend); JPanel p = new JPanel(); p.setLayout(new BorderLayout()); p.add("South", l); p.add("Center", new javax.media.jai.widget.ImageCanvas(image)); p.setBackground(new Color(0xFFFFFF)); p.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); return p; }
From source file:be.ac.ua.comp.scarletnebula.gui.SSHPanel.java
public SSHPanel(final Server server) { super();//www. ja v a 2s. c o m final JCTermSwing term = new JCTermSwing(); term.setCompression(7); term.setAntiAliasing(true); setLayout(new BorderLayout()); addComponentListener(new ComponentListener() { @Override public void componentShown(final ComponentEvent e) { } @Override public void componentResized(final ComponentEvent e) { final Component c = e.getComponent(); int cw = c.getWidth(); int ch = c.getHeight(); final JPanel source = ((JPanel) c); final int cwm = source.getBorder() != null ? source.getBorder().getBorderInsets(c).left + source.getBorder().getBorderInsets(c).right : 0; final int chm = source.getBorder() != null ? source.getBorder().getBorderInsets(c).bottom + source.getBorder().getBorderInsets(c).top : 0; cw -= cwm; ch -= chm; term.setBorder(BorderFactory.createMatteBorder(0, 0, term.getTermHeight() - c.getHeight(), term.getTermWidth() - c.getWidth(), Color.BLACK)); term.setSize(cw, ch); term.setPreferredSize(new Dimension(cw, ch)); // term.setMinimumSize(new Dimension(cw, ch)); term.setMaximumSize(new Dimension(cw, ch)); term.redraw(0, 0, term.getTermWidth(), term.getTermHeight()); } @Override public void componentMoved(final ComponentEvent e) { // TODO // Auto-generated // method // stub } @Override public void componentHidden(final ComponentEvent e) { // TODO // Auto-generated // method // stub } }); add(term, BorderLayout.CENTER); setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20), BorderFactory.createBevelBorder(BevelBorder.LOWERED))); final Thread connectionThread = new Thread() { @Override public void run() { Connection connection = null; try { final SSHCommandConnection commandConnection = (SSHCommandConnection) server .newCommandConnection(new NotPromptingJschUserInfo()); connection = commandConnection.getJSchTerminalConnection(); term.requestFocusInWindow(); term.start(connection); } catch (final Exception e) { for (final ExceptionListener listener : exceptionListeners) { listener.exceptionThrown(e); } log.warn("Exception thrown by SSHPanel", e); } finally { } } }; connectionThread.start(); }
From source file:HtmlDemo.java
public HtmlDemo() { setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS)); String initialText = "<html>\n" + "Color and font test:\n" + "<ul>\n" + "<li><font color=red>red</font>\n" + "<li><font color=blue>blue</font>\n" + "<li><font color=green>green</font>\n" + "<li><font size=-2>small</font>\n" + "<li><font size=+2>large</font>\n" + "<li><i>italic</i>\n" + "<li><b>bold</b>\n" + "</ul>\n"; htmlTextArea = new JTextArea(10, 20); htmlTextArea.setText(initialText);/* w ww . j ava 2 s . com*/ JScrollPane scrollPane = new JScrollPane(htmlTextArea); JButton changeTheLabel = new JButton("Change the label"); changeTheLabel.setMnemonic(KeyEvent.VK_C); changeTheLabel.setAlignmentX(Component.CENTER_ALIGNMENT); changeTheLabel.addActionListener(this); theLabel = new JLabel(initialText) { public Dimension getPreferredSize() { return new Dimension(200, 200); } public Dimension getMinimumSize() { return new Dimension(200, 200); } public Dimension getMaximumSize() { return new Dimension(200, 200); } }; theLabel.setVerticalAlignment(SwingConstants.CENTER); theLabel.setHorizontalAlignment(SwingConstants.CENTER); JPanel leftPanel = new JPanel(); leftPanel.setLayout(new BoxLayout(leftPanel, BoxLayout.PAGE_AXIS)); leftPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder("Edit the HTML, then click the button"), BorderFactory.createEmptyBorder(10, 10, 10, 10))); leftPanel.add(scrollPane); leftPanel.add(Box.createRigidArea(new Dimension(0, 10))); leftPanel.add(changeTheLabel); JPanel rightPanel = new JPanel(); rightPanel.setLayout(new BoxLayout(rightPanel, BoxLayout.PAGE_AXIS)); rightPanel .setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("A label with HTML"), BorderFactory.createEmptyBorder(10, 10, 10, 10))); rightPanel.add(theLabel); setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); add(leftPanel); add(Box.createRigidArea(new Dimension(10, 0))); add(rightPanel); }
From source file:CustomComboBoxDemo.java
public CustomComboBoxDemo() { super(new BorderLayout()); //Load the pet images and create an array of indexes. images = new ImageIcon[petStrings.length]; Integer[] intArray = new Integer[petStrings.length]; for (int i = 0; i < petStrings.length; i++) { intArray[i] = new Integer(i); images[i] = createImageIcon("images/" + petStrings[i] + ".gif"); if (images[i] != null) { images[i].setDescription(petStrings[i]); }/* ww w . j a v a 2 s .c o m*/ } //Create the combo box. JComboBox petList = new JComboBox(intArray); ComboBoxRenderer renderer = new ComboBoxRenderer(); renderer.setPreferredSize(new Dimension(200, 130)); petList.setRenderer(renderer); petList.setMaximumRowCount(3); //Lay out the demo. add(petList, BorderLayout.PAGE_START); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); }
From source file:components.TextSamplerDemo.java
public TextSamplerDemo() { setLayout(new BorderLayout()); //Create a regular text field. JTextField textField = new JTextField(10); textField.setActionCommand(textFieldString); textField.addActionListener(this); //Create a password field. JPasswordField passwordField = new JPasswordField(10); passwordField.setActionCommand(passwordFieldString); passwordField.addActionListener(this); //Create a formatted text field. JFormattedTextField ftf = new JFormattedTextField(java.util.Calendar.getInstance().getTime()); ftf.setActionCommand(textFieldString); ftf.addActionListener(this); //Create some labels for the fields. JLabel textFieldLabel = new JLabel(textFieldString + ": "); textFieldLabel.setLabelFor(textField); JLabel passwordFieldLabel = new JLabel(passwordFieldString + ": "); passwordFieldLabel.setLabelFor(passwordField); JLabel ftfLabel = new JLabel(ftfString + ": "); ftfLabel.setLabelFor(ftf);/* w w w.ja va2s. c o m*/ //Create a label to put messages during an action event. actionLabel = new JLabel("Type text in a field and press Enter."); actionLabel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); //Lay out the text controls and the labels. JPanel textControlsPane = new JPanel(); GridBagLayout gridbag = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); textControlsPane.setLayout(gridbag); JLabel[] labels = { textFieldLabel, passwordFieldLabel, ftfLabel }; JTextField[] textFields = { textField, passwordField, ftf }; addLabelTextRows(labels, textFields, gridbag, textControlsPane); c.gridwidth = GridBagConstraints.REMAINDER; //last c.anchor = GridBagConstraints.WEST; c.weightx = 1.0; textControlsPane.add(actionLabel, c); textControlsPane.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder("Text Fields"), BorderFactory.createEmptyBorder(5, 5, 5, 5))); //Create a text area. JTextArea textArea = new JTextArea("This is an editable JTextArea. " + "A text area is a \"plain\" text component, " + "which means that although it can display text " + "in any font, all of the text is in the same font."); textArea.setFont(new Font("Serif", Font.ITALIC, 16)); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); JScrollPane areaScrollPane = new JScrollPane(textArea); areaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); areaScrollPane.setPreferredSize(new Dimension(250, 250)); areaScrollPane.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Plain Text"), BorderFactory.createEmptyBorder(5, 5, 5, 5)), areaScrollPane.getBorder())); //Create an editor pane. JEditorPane editorPane = createEditorPane(); JScrollPane editorScrollPane = new JScrollPane(editorPane); editorScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); editorScrollPane.setPreferredSize(new Dimension(250, 145)); editorScrollPane.setMinimumSize(new Dimension(10, 10)); //Create a text pane. JTextPane textPane = createTextPane(); JScrollPane paneScrollPane = new JScrollPane(textPane); paneScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); paneScrollPane.setPreferredSize(new Dimension(250, 155)); paneScrollPane.setMinimumSize(new Dimension(10, 10)); //Put the editor pane and the text pane in a split pane. JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, editorScrollPane, paneScrollPane); splitPane.setOneTouchExpandable(true); splitPane.setResizeWeight(0.5); JPanel rightPane = new JPanel(new GridLayout(1, 0)); rightPane.add(splitPane); rightPane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Styled Text"), BorderFactory.createEmptyBorder(5, 5, 5, 5))); //Put everything together. JPanel leftPane = new JPanel(new BorderLayout()); leftPane.add(textControlsPane, BorderLayout.PAGE_START); leftPane.add(areaScrollPane, BorderLayout.CENTER); add(leftPane, BorderLayout.LINE_START); add(rightPane, BorderLayout.LINE_END); }
From source file:components.ListDemo.java
public ListDemo() { super(new BorderLayout()); listModel = new DefaultListModel(); listModel.addElement("Jane Doe"); listModel.addElement("John Smith"); listModel.addElement("Kathy Green"); //Create the list and put it in a scroll pane. list = new JList(listModel); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.setSelectedIndex(0);//from w w w .j a v a2 s . com list.addListSelectionListener(this); list.setVisibleRowCount(5); JScrollPane listScrollPane = new JScrollPane(list); JButton hireButton = new JButton(hireString); HireListener hireListener = new HireListener(hireButton); hireButton.setActionCommand(hireString); hireButton.addActionListener(hireListener); hireButton.setEnabled(false); fireButton = new JButton(fireString); fireButton.setActionCommand(fireString); fireButton.addActionListener(new FireListener()); employeeName = new JTextField(10); employeeName.addActionListener(hireListener); employeeName.getDocument().addDocumentListener(hireListener); String name = listModel.getElementAt(list.getSelectedIndex()).toString(); //Create a panel that uses BoxLayout. JPanel buttonPane = new JPanel(); buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS)); buttonPane.add(fireButton); buttonPane.add(Box.createHorizontalStrut(5)); buttonPane.add(new JSeparator(SwingConstants.VERTICAL)); buttonPane.add(Box.createHorizontalStrut(5)); buttonPane.add(employeeName); buttonPane.add(hireButton); buttonPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); add(listScrollPane, BorderLayout.CENTER); add(buttonPane, BorderLayout.PAGE_END); }
From source file:DragFileDemo.java
public DragFileDemo() { super(new BorderLayout()); fc = new JFileChooser(); ;/*w w w . ja v a 2 s .c om*/ fc.setMultiSelectionEnabled(true); fc.setDragEnabled(true); fc.setControlButtonsAreShown(false); JPanel fcPanel = new JPanel(new BorderLayout()); fcPanel.add(fc, BorderLayout.CENTER); clear = new JButton("Clear All"); clear.addActionListener(this); JPanel buttonPanel = new JPanel(new BorderLayout()); buttonPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); buttonPanel.add(clear, BorderLayout.LINE_END); JPanel upperPanel = new JPanel(new BorderLayout()); upperPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); upperPanel.add(fcPanel, BorderLayout.CENTER); upperPanel.add(buttonPanel, BorderLayout.PAGE_END); //The TabbedPaneController manages the panel that //contains the tabbed pane. When there are no files //the panel contains a plain text area. Then, as //files are dropped onto the area, the tabbed panel //replaces the file area. JTabbedPane tabbedPane = new JTabbedPane(); JPanel tabPanel = new JPanel(new BorderLayout()); tabPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); tpc = new TabbedPaneController(tabbedPane, tabPanel); JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, upperPanel, tabPanel); splitPane.setDividerLocation(400); splitPane.setPreferredSize(new Dimension(530, 650)); add(splitPane, BorderLayout.CENTER); }
From source file:net.pandoragames.far.ui.swing.RenameFilesPanel.java
private void init(SwingConfig config, ComponentRepository componentRepository) { this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); this.setBorder( BorderFactory.createEmptyBorder(0, SwingConfig.PADDING, SwingConfig.PADDING, SwingConfig.PADDING)); this.add(Box.createRigidArea(new Dimension(1, SwingConfig.PADDING))); JLabel patternLabel = new JLabel(localizer.localize("label.find-pattern")); this.add(patternLabel); filenamePattern = new JTextField(); filenamePattern.setPreferredSize(//from w w w .j a v a 2 s . c o m new Dimension(SwingConfig.COMPONENT_WIDTH_LARGE, config.getStandardComponentHight())); filenamePattern .setMaximumSize(new Dimension(SwingConfig.COMPONENT_WIDTH_MAX, config.getStandardComponentHight())); filenamePattern.setAlignmentX(Component.LEFT_ALIGNMENT); UndoHistory findUndoManager = new UndoHistory(); findUndoManager.registerUndoHistory(filenamePattern); findUndoManager.registerSnapshotHistory(filenamePattern); componentRepository.getReplaceCommand().addResetable(findUndoManager); filenamePattern.getDocument().addDocumentListener(new DocumentChangeListener() { public void documentUpdated(DocumentEvent e, String text) { dataModel.setPatternString(text); updateFileTable(); } }); componentRepository.getResetDispatcher().addToBeCleared(filenamePattern); this.add(filenamePattern); JCheckBox caseBox = new JCheckBox(localizer.localize("label.ignore-case")); caseBox.setSelected(true); caseBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent event) { dataModel.setIgnoreCase((ItemEvent.SELECTED == event.getStateChange())); updateFileTable(); } }); this.add(caseBox); JCheckBox regexBox = new JCheckBox(localizer.localize("label.regular-expression")); regexBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent event) { dataModel.setRegexPattern((ItemEvent.SELECTED == event.getStateChange())); updateFileTable(); } }); this.add(regexBox); JPanel extensionPanel = new JPanel(); extensionPanel.setBorder(BorderFactory.createTitledBorder(localizer.localize("label.modify-extension"))); extensionPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); extensionPanel.setAlignmentX(Component.LEFT_ALIGNMENT); extensionPanel.setPreferredSize(new Dimension(SwingConfig.COMPONENT_WIDTH_LARGE, 60)); extensionPanel.setMaximumSize(new Dimension(SwingConfig.COMPONENT_WIDTH_MAX, 100)); ButtonGroup extensionGroup = new ButtonGroup(); JRadioButton protectButton = new JRadioButton(localizer.localize("label.protect-extension")); protectButton.setSelected(true); protectButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { dataModel.setProtectExtension(true); updateFileTable(); } }); extensionGroup.add(protectButton); extensionPanel.add(protectButton); JRadioButton includeButton = new JRadioButton(localizer.localize("label.include-extension")); includeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { dataModel.setExtensionOnly(false); dataModel.setProtectExtension(false); updateFileTable(); } }); extensionGroup.add(includeButton); extensionPanel.add(includeButton); JRadioButton onlyButton = new JRadioButton(localizer.localize("label.only-extension")); onlyButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { dataModel.setExtensionOnly(true); updateFileTable(); } }); extensionGroup.add(onlyButton); extensionPanel.add(onlyButton); this.add(extensionPanel); this.add(Box.createVerticalGlue()); this.add(Box.createRigidArea(new Dimension(1, SwingConfig.PADDING))); // replace JLabel replaceLabel = new JLabel(localizer.localize("label.replacement-pattern")); this.add(replaceLabel); replacePattern = new JTextField(); replacePattern.setPreferredSize( new Dimension(SwingConfig.COMPONENT_WIDTH_LARGE, config.getStandardComponentHight())); replacePattern .setMaximumSize(new Dimension(SwingConfig.COMPONENT_WIDTH_MAX, config.getStandardComponentHight())); replacePattern.setAlignmentX(Component.LEFT_ALIGNMENT); UndoHistory undoManager = new UndoHistory(); undoManager.registerUndoHistory(replacePattern); undoManager.registerSnapshotHistory(replacePattern); componentRepository.getReplaceCommand().addResetable(undoManager); replacePattern.getDocument().addDocumentListener(new DocumentChangeListener() { public void documentUpdated(DocumentEvent e, String text) { dataModel.setReplacementString(text); updateFileTable(); } }); componentRepository.getResetDispatcher().addToBeCleared(replacePattern); this.add(replacePattern); // treat case JPanel modifyCasePanel = new JPanel(); modifyCasePanel.setBorder(BorderFactory.createTitledBorder(localizer.localize("label.modify-case"))); modifyCasePanel.setLayout(new BoxLayout(modifyCasePanel, BoxLayout.Y_AXIS)); modifyCasePanel.setAlignmentX(Component.LEFT_ALIGNMENT); modifyCasePanel.setPreferredSize(new Dimension(SwingConfig.COMPONENT_WIDTH_LARGE, 100)); modifyCasePanel.setMaximumSize(new Dimension(SwingConfig.COMPONENT_WIDTH_MAX, 200)); ButtonGroup modifyCaseGroup = new ButtonGroup(); ActionListener radioButtonListener = new ActionListener() { public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); dataModel.setTreatCase(RenameForm.CASEHANDLING.valueOf(cmd)); updateFileTable(); } }; JRadioButton lowerButton = new JRadioButton(localizer.localize("label.to-lower-case")); lowerButton.setActionCommand(RenameForm.CASEHANDLING.LOWER.name()); lowerButton.addActionListener(radioButtonListener); modifyCaseGroup.add(lowerButton); modifyCasePanel.add(lowerButton); JRadioButton upperButton = new JRadioButton(localizer.localize("label.to-upper-case")); upperButton.setActionCommand(RenameForm.CASEHANDLING.UPPER.name()); upperButton.addActionListener(radioButtonListener); modifyCaseGroup.add(upperButton); modifyCasePanel.add(upperButton); JRadioButton keepButton = new JRadioButton(localizer.localize("label.preserve-case")); keepButton.setActionCommand(RenameForm.CASEHANDLING.PRESERVE.name()); keepButton.setSelected(true); keepButton.addActionListener(radioButtonListener); modifyCaseGroup.add(keepButton); modifyCasePanel.add(keepButton); this.add(modifyCasePanel); // prevent case conflict JCheckBox caseConflictBox = new JCheckBox(localizer.localize("label.prevent-case-conflict")); caseConflictBox.setAlignmentX(Component.LEFT_ALIGNMENT); caseConflictBox.setSelected(true); caseConflictBox.setEnabled(!SwingConfig.isWindows()); // disabled on windows caseConflictBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent event) { dataModel.setPreventCaseConflict((ItemEvent.SELECTED == event.getStateChange())); updateFileTable(); } }); this.add(caseConflictBox); this.add(Box.createVerticalGlue()); }