List of usage examples for javax.swing BorderFactory createCompoundBorder
public static CompoundBorder createCompoundBorder(Border outsideBorder, Border insideBorder)
From source file:ome.formats.importer.gui.StatusBar.java
/** * Build and lay out the UI//from w w w .j a va 2 s. co m */ private void buildUI() { Border compoundBorder = BorderFactory.createCompoundBorder(BorderFactory.createLoweredBevelBorder(), BorderFactory.createEmptyBorder(0, 4, 0, 15)); setPreferredSize(new Dimension(10, 28)); setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); setBorder( BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(0, -2, -2, -2), compoundBorder)); add(status); add(buildComponentPanelRight(progressBar)); }
From source file:org.datavyu.controllers.component.TrackController.java
/** * Creates a new TrackController.// w w w.j a v a2s . c o m * * @param trackPainter the track painter for this controller to manage. */ public TrackController(final MixerModel mixerModel, final TrackPainter trackPainter) { isMoveable = true; view = new JPanel(); view.setLayout(new MigLayout("fillx, ins 0", "[]0[]")); view.setBorder(BorderFactory.createLineBorder(TrackConstants.BORDER_COLOR, 1)); this.trackPainter = trackPainter; this.mixerModel = mixerModel; trackModel = new TrackModel(); trackModel.setState(TrackState.NORMAL); trackModel.clearBookmarks(); trackModel.setLocked(false); trackPainter.setMixerView(mixerModel); trackPainter.setTrackModel(trackModel); mixerModel.getViewportModel().addPropertyChangeListener(this); listenerList = new EventListenerList(); final TrackPainterListener painterListener = new TrackPainterListener(); trackPainter.addMouseListener(painterListener); trackPainter.addMouseMotionListener(painterListener); menu = new JPopupMenu(); menu.setName("trackPopUpMenu"); setBookmarkMenuItem = new JMenuItem("Set bookmark"); setBookmarkMenuItem.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { TrackController.this.setBookmarkAction(); } }); clearBookmarkMenuItem = new JMenuItem("Clear bookmarks"); clearBookmarkMenuItem.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { TrackController.this.clearBookmarkAction(); } }); menu.add(setBookmarkMenuItem); menu.add(clearBookmarkMenuItem); trackPainter.add(menu); // Create the Header panel and its components trackLabel = new JLabel("", SwingConstants.CENTER); trackLabel.setName("trackLabel"); trackLabel.setHorizontalAlignment(SwingConstants.CENTER); trackLabel.setHorizontalTextPosition(SwingConstants.CENTER); iconLabel = new JLabel("", SwingConstants.CENTER); iconLabel.setHorizontalAlignment(SwingConstants.CENTER); iconLabel.setHorizontalTextPosition(SwingConstants.CENTER); header = new JPanel(new MigLayout("ins 0, wrap 6")); header.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createMatteBorder(0, 0, 0, 1, TrackConstants.BORDER_COLOR), BorderFactory.createEmptyBorder(2, 2, 2, 2))); header.setBackground(Color.LIGHT_GRAY); // Normally I would use pushx instead of defining the width, but in this // case I defined the width because span combined with push makes the // first action icon cell push out as well. 136 was calculated from // 140 pixels minus 2 minus 2 (from the empty border defined above). header.add(trackLabel, "span 6, w 136!, center, growx"); header.add(iconLabel, "span 6, w 136!, h 32!, center, growx"); // Set up the button used for locking/unlocking track movement { lockUnlockButton = new JButton(TrackConstants.UNLOCK_ICON); lockUnlockButton.setName("lockUnlockButton"); lockUnlockButton.setContentAreaFilled(false); lockUnlockButton.setBorderPainted(false); lockUnlockButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { handleLockUnlockButtonEvent(e); } }); Map<String, String> constraints = Maps.newHashMap(); constraints.put("width", Integer.toString(TrackConstants.ACTION_BUTTON_WIDTH)); constraints.put("height", Integer.toString(TrackConstants.ACTION_BUTTON_HEIGHT)); String template = "cell 0 2, w ${width}!, h ${height}!"; StrSubstitutor sub = new StrSubstitutor(constraints); header.add(lockUnlockButton, sub.replace(template)); } // Set up the button used for hiding/showing a track's data viewer { visibleButton = new JButton(TrackConstants.VIEWER_HIDE_ICON); visibleButton.setName("visibleButton"); visibleButton.setContentAreaFilled(false); visibleButton.setBorderPainted(false); visibleButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { handleVisibleButtonEvent(e); } }); Map<String, String> constraints = Maps.newHashMap(); constraints.put("width", Integer.toString(TrackConstants.ACTION_BUTTON_WIDTH)); constraints.put("height", Integer.toString(TrackConstants.ACTION_BUTTON_HEIGHT)); String template = "cell 1 2, w ${width}!, h ${height}!"; StrSubstitutor sub = new StrSubstitutor(constraints); header.add(visibleButton, sub.replace(template)); } // Set up the button used for removing a track and its plugin { rubbishButton = new JButton(TrackConstants.DELETE_ICON); rubbishButton.setName("rubbishButton"); rubbishButton.setContentAreaFilled(false); rubbishButton.setBorderPainted(false); rubbishButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { handleDeleteButtonEvent(e); } }); Map<String, String> constraints = Maps.newHashMap(); constraints.put("width", Integer.toString(TrackConstants.ACTION_BUTTON_WIDTH)); constraints.put("height", Integer.toString(TrackConstants.ACTION_BUTTON_HEIGHT)); String template = "cell 5 2, w ${width}!, h ${height}!"; StrSubstitutor sub = new StrSubstitutor(constraints); header.add(rubbishButton, sub.replace(template)); } // Add the header to our layout. { Map<String, String> constraints = Maps.newHashMap(); constraints.put("width", Integer.toString(TrackConstants.HEADER_WIDTH)); constraints.put("height", Integer.toString(TrackConstants.CARRIAGE_HEIGHT)); String template = "w ${width}!, h ${height}!"; StrSubstitutor sub = new StrSubstitutor(constraints); view.add(header, sub.replace(template)); } // Add the track carriage to our layout. { Map<String, String> constraints = Maps.newHashMap(); constraints.put("height", Integer.toString(TrackConstants.CARRIAGE_HEIGHT)); String template = "pushx, growx, h ${height}!"; StrSubstitutor sub = new StrSubstitutor(constraints); view.add(trackPainter, sub.replace(template)); } view.validate(); }
From source file:org.dwfa.ace.classifier.CNFormsLabelPanel.java
private void setBorder(JLabel tLabel, Color deltaColor) { if (deltaColor == null) { deltaColor = Color.white; }/*from w w w . j a v a 2 s . com*/ Dimension size = tLabel.getSize(); tLabel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createRaisedBevelBorder(), BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(1, 5, 1, 5, deltaColor), BorderFactory.createEmptyBorder(1, 3, 1, 3)))); size.width = size.width + 18; size.height = size.height + 6; tLabel.setSize(size); tLabel.setPreferredSize(size); tLabel.setMaximumSize(size); tLabel.setMinimumSize(size); }
From source file:org.kepler.gui.kar.KarManifestViewer.java
public void initialize(KARFile karFile) { if (isDebugging) { log.debug("initialize( " + karFile + " )"); }// w ww . ja va 2s . c o m _karFile = karFile; JPanel layoutPanel = new JPanel(); layoutPanel.setLayout(new BorderLayout()); JPanel lsidPanel = new JPanel(); lsidPanel.setLayout(new BorderLayout()); JLabel lsidLabel = new JLabel("KAR LSID:"); lsidPanel.add(lsidLabel, BorderLayout.WEST); _lsidField = new JTextField(""); _lsidField.setEditable(false); lsidPanel.add(_lsidField, BorderLayout.CENTER); JPanel dfPanel = new JPanel(); dfPanel.setLayout(new BorderLayout()); _manifestField = new JTextArea(""); _manifestField.setEditable(false); _manifestScrollPane = new JScrollPane(_manifestField); _manifestScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); _manifestScrollPane .setBorder( BorderFactory.createCompoundBorder( BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Manifest"), BorderFactory.createEmptyBorder(5, 5, 5, 5)), _manifestScrollPane.getBorder())); dfPanel.add(_manifestScrollPane, BorderLayout.CENTER); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BorderLayout()); String infStr = _karFile.getName(); JLabel objInfo = new JLabel(infStr); buttonPanel.add(objInfo, BorderLayout.CENTER); JButton refreshButton = new JButton("Refresh"); refreshButton.addActionListener(this); buttonPanel.add(refreshButton, BorderLayout.EAST); layoutPanel.add(lsidPanel, BorderLayout.NORTH); layoutPanel.add(dfPanel, BorderLayout.CENTER); layoutPanel.add(buttonPanel, BorderLayout.SOUTH); getContentPane().add(layoutPanel); refreshValues(); getContentPane().setBackground(Color.WHITE); }
From source file:org.kepler.gui.lsid.LSIDViewer.java
public void initialize(NamedObj no) { if (isDebugging) { log.debug("initialize( " + no.getName() + " " + no.getClass().getName() + " )"); }/*from www . j av a2 s .c om*/ _no = no; JPanel layoutPanel = new JPanel(); layoutPanel.setLayout(new BorderLayout()); JPanel lsidPanel = new JPanel(); lsidPanel.setLayout(new BorderLayout()); JLabel lsidLabel = new JLabel("LSID:"); lsidPanel.add(lsidLabel, BorderLayout.WEST); _lsidField = new JTextField(""); _lsidField.setEditable(false); lsidPanel.add(_lsidField, BorderLayout.CENTER); JPanel dfPanel = new JPanel(); dfPanel.setLayout(new BorderLayout()); _derivedFromField = new JTextArea(""); _derivedFromField.setEditable(false); _derivedFromScrollPane = new JScrollPane(_derivedFromField); _derivedFromScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); _derivedFromScrollPane .setBorder( BorderFactory.createCompoundBorder( BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Derived From"), BorderFactory.createEmptyBorder(5, 5, 5, 5)), _derivedFromScrollPane.getBorder())); dfPanel.add(_derivedFromScrollPane, BorderLayout.CENTER); JPanel bottomPanel = new JPanel(); bottomPanel.setLayout(new BorderLayout()); String infStr = "Name: " + _no.getName(); JLabel objInfo = new JLabel(infStr); if (isEditingEnabled()) { bottomPanel.add(objInfo, BorderLayout.NORTH); } else { bottomPanel.add(objInfo, BorderLayout.CENTER); } JPanel buttonPanel = new JPanel(); if (isEditingEnabled()) { JButton newObjButton = new JButton("New Object ID"); newObjButton.addActionListener(this); buttonPanel.add(newObjButton); JButton revisionButton = new JButton("Roll Revision"); revisionButton.addActionListener(this); buttonPanel.add(revisionButton); } JButton refreshButton = new JButton("Refresh"); refreshButton.addActionListener(this); buttonPanel.add(refreshButton); bottomPanel.add(buttonPanel, BorderLayout.EAST); layoutPanel.add(lsidPanel, BorderLayout.NORTH); layoutPanel.add(dfPanel, BorderLayout.CENTER); layoutPanel.add(bottomPanel, BorderLayout.SOUTH); getContentPane().add(layoutPanel); refreshValues(); }
From source file:org.nuxeo.launcher.gui.NuxeoFrame.java
public void debug(JComponent parent) { for (Component comp : parent.getComponents()) { if (comp instanceof JComponent) { ((JComponent) comp).setBorder(BorderFactory.createCompoundBorder( BorderFactory.createLineBorder(Color.red), ((JComponent) comp).getBorder())); log.info(comp.getClass() + " size: " + ((JComponent) comp).getSize()); }/*from w ww . j a v a2 s . co m*/ } }
From source file:org.optaplanner.examples.meetingscheduling.swingui.MeetingSchedulingPanel.java
private JPanel createTableHeader(JLabel label) { JPanel headerPanel = new JPanel(new BorderLayout()); headerPanel.add(label, BorderLayout.NORTH); headerPanel.setBorder(/*from w ww. ja v a2 s. com*/ BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(TangoColorFactory.ALUMINIUM_5), BorderFactory.createEmptyBorder(2, 2, 2, 2))); return headerPanel; }
From source file:org.optaplanner.mes.common.swingui.SolverAndPersistenceFrame.java
private void setScoreTextArea(String title, Solution<?> solution) { Schedule schedule = (Schedule) solution; if (schedule != null && scoreTextArea != null) { Number[] scoreLevelNumbers = solution.getScore().toLevelNumbers(); int scoreLevelNr = 0; String scoreString = ""; for (int i = 0; i != schedule.getHardScoreDefArray().length; i++) { if (scoreString != "") { scoreString += "\n"; }/*from w w w .j a v a 2 s . com*/ String scoreName = schedule.getHardScoreDefArray()[i].getName(); String scoreDescription = schedule.getHardScoreDefArray()[i].getDescription(); if (scoreDescription != "") { scoreDescription = " (" + scoreDescription.toLowerCase() + ")"; } String bestValueString = scoreLevelNumbers[scoreLevelNr++].toString(); scoreString += "H" + (i + 1) + ". " + scoreName + scoreDescription + "\n = " + bestValueString; } for (int i = 0; i != schedule.getSoftScoreDefArray().length; i++) { if (scoreString != "") { scoreString += "\n"; } String scoreName = schedule.getSoftScoreDefArray()[i].getName(); String scoreDescription = schedule.getSoftScoreDefArray()[i].getDescription(); if (scoreDescription != "") { scoreDescription = " (" + scoreDescription.toLowerCase() + ")"; } String bestValueString = scoreLevelNumbers[scoreLevelNr++].toString(); scoreString += "S" + (i + 1) + ". " + scoreName + scoreDescription + "\n = " + bestValueString; } scoreTextArea.setText(scoreString); scoreFieldTitlePanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createEmptyBorder(2, 2, 2, 2), BorderFactory.createTitledBorder(title))); } }
From source file:org.optaplanner.mes.common.swingui.SolverAndPersistenceFrame.java
private JComponent createScoreFieldPanel() { scoreFieldPanel = new JPanel(); scoreTextArea = new JTextArea(); scoreFieldPanel.add(scoreTextArea);//from ww w. ja v a 2 s.c o m scoreFieldPanel.setLayout(new BoxLayout(scoreFieldPanel, BoxLayout.Y_AXIS)); JScrollPane scrollPane = new JScrollPane(scoreFieldPanel); scrollPane.getVerticalScrollBar().setUnitIncrement(25); scrollPane.setMinimumSize(new Dimension(100, 80)); // Size fits into screen resolution 1024*768 scrollPane.setPreferredSize(new Dimension(180, 200)); scoreFieldTitlePanel = new JPanel(new BorderLayout()); scoreFieldTitlePanel.add(scrollPane, BorderLayout.CENTER); scoreFieldTitlePanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createEmptyBorder(2, 2, 2, 2), BorderFactory.createTitledBorder("Score"))); return scoreFieldTitlePanel; }
From source file:org.owasp.jbrofuzz.fuzz.ui.FuzzingPanel.java
/** * <p>//from w ww . jav a 2 s. c o m * This constructor is used for the " Fuzzing " panel that resides under the * FrameWindow, within the corresponding tabbed panel. * </p> * * * @param mWindow * FrameWindow */ public FuzzingPanel(final JBroFuzzWindow mWindow) { super(" Fuzzing ", mWindow); counter = 0; payload = ""; stopped = true; // Set the enabled options: Start, Stop, Pause, Add, Remove setOptionsAvailable(true, false, false, true, false); // The Target panel final JPanel targetPanel = new JPanel(new BorderLayout()); targetPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(" Target "), BorderFactory.createEmptyBorder(1, 1, 1, 1))); urlField = new JTextField(); urlField.setEditable(true); urlField.setVisible(true); urlField.setFont(new Font("Verdana", Font.BOLD, 12)); urlField.setToolTipText("[{Protocol} :// {Host} [:{Port}]]"); urlField.setMargin(new Insets(1, 1, 1, 1)); urlField.setBackground(Color.WHITE); urlField.setForeground(Color.BLACK); requestPane = createEditablePane(); // Right click: Cut, Copy, Paste, Select All AbstractPanel.popupText(urlField, true, true, true, true); targetPanel.add(urlField); // The fuzzers panel fuzzersPanel = new FuzzersPanel(this); // The on the wire panel final JPanel onTheWirePanel = new JPanel(); onTheWirePanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(" Requests "), BorderFactory.createEmptyBorder(5, 5, 5, 5))); mWireTextArea = new WireTextArea(); // Right click: Cut, Copy, Paste, Select All RightClickPopups.rightClickOnTheWireTextComponent(this, mWireTextArea); final JScrollPane consoleScrollPane = new JScrollPane(mWireTextArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); onTheWirePanel.setLayout(new BorderLayout()); onTheWirePanel.add(consoleScrollPane, BorderLayout.CENTER); // Set the scroll areas topPanel = new JPanel(new BorderLayout()); topPanel.add(targetPanel, BorderLayout.PAGE_START); topPanel.add(createScrollingPanel(" Request ", requestPane), BorderLayout.CENTER); // create the outlining tabbed pane fuzzerWindowPane = new JTabbedPane(); bottomPane = new FuzzSplitPane(FuzzSplitPane.HORIZONTAL_SPLIT, FuzzSplitPane.FUZZ_BOTTOM); bottomPane.setLeftComponent(fuzzersPanel); transformsPanel = new TransformsPanel(this); bottomPane.setRightComponent(transformsPanel); mainPane = new FuzzSplitPane(FuzzSplitPane.VERTICAL_SPLIT, FuzzSplitPane.FUZZ_MAIN); mainPane.setOneTouchExpandable(false); mainPane.setTopComponent(topPanel); mainPane.setBottomComponent(bottomPane); // Allow for all areas to be resized to even not be seen topPanel.setMinimumSize(JBroFuzzFormat.ZERO_DIM); bottomPane.setMinimumSize(JBroFuzzFormat.ZERO_DIM); // Create the outputPanel outputPanel = new OutputPanel(this); // add the respective panes/panels to the tabbed pane fuzzerWindowPane.addTab("Input", mainPane); fuzzerWindowPane.addTab("Output", outputPanel); fuzzerWindowPane.addTab("On the wire", onTheWirePanel); add(fuzzerWindowPane, BorderLayout.CENTER); // Display the last displayed url/request setTextURL(JBroFuzz.PREFS.get(JBroFuzzPrefs.TEXT_URL, "")); setTextRequest(JBroFuzz.PREFS.get(JBroFuzzPrefs.TEXT_REQUEST, "")); }