Java Code Examples for javax.swing.BorderFactory#createEmptyBorder()
The following examples show how to use
javax.swing.BorderFactory#createEmptyBorder() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TransparentToolBar.java From visualvm with GNU General Public License v2.0 | 6 votes |
private static Border createToolBarBorder(boolean horizontal) { if (horizontal) { if (UISupport.isAquaLookAndFeel()) { return BorderFactory.createEmptyBorder(-1, 2, -1, 2); } else if (UISupport.isNimbusLookAndFeel()) { return BorderFactory.createEmptyBorder(1, 2, 1, 2); } else { return BorderFactory.createEmptyBorder(2, 2, 2, 2); } } else { if (UISupport.isAquaLookAndFeel()) { return BorderFactory.createEmptyBorder(-1, 0, -1, 0); } else { return BorderFactory.createEmptyBorder(); } } }
Example 2
Source File: LexerFrame.java From groovy with Apache License 2.0 | 6 votes |
private void jbInit(Reader reader) throws Exception { final Border border = BorderFactory.createEmptyBorder(); jSplitPane1.setOrientation(JSplitPane.VERTICAL_SPLIT); tokenPane.setEditable(false); tokenPane.setText(""); scriptPane.setFont(new java.awt.Font("DialogInput", 0, 12)); scriptPane.setEditable(false); scriptPane.setMargin(new Insets(5, 5, 5, 5)); scriptPane.setText(""); jScrollPane1.setBorder(border); jScrollPane2.setBorder(border); jSplitPane1.setMinimumSize(new Dimension(800, 600)); mainPanel.add(jSplitPane1, BorderLayout.CENTER); if (reader == null) { mainPanel.add(jbutton, BorderLayout.NORTH); } this.getContentPane().add(mainPanel); jSplitPane1.add(jScrollPane1, JSplitPane.LEFT); jScrollPane1.getViewport().add(tokenPane, null); jSplitPane1.add(jScrollPane2, JSplitPane.RIGHT); jScrollPane2.getViewport().add(scriptPane, null); jScrollPane1.setColumnHeaderView(new JLabel(" Token Stream:")); jScrollPane2.setColumnHeaderView(new JLabel(" Input Script:")); jSplitPane1.setResizeWeight(0.5); }
Example 3
Source File: ImportPreviewTable.java From chipster with MIT License | 6 votes |
@Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); this.row = row; this.column = column; // This removes the borders when a cell is focused if (hasFocus) { Border border = BorderFactory.createEmptyBorder(1,1,1,1); setBorder(border); } // Highlights if(highlightRow && row == mouseOverRow){ setBackground(new Color(250,250,250)); } else if(highlightColumn && column == mouseOverColumn){ setBackground(new Color(250,250,250)); } else { setBackground(UIManager.getColor("Table.background")); } return this; }
Example 4
Source File: MainFrame.java From uima-uimaj with Apache License 2.0 | 6 votes |
/** * Creates the text area. */ private void createTextArea() { try { this.textArea = new JTextArea(); this.addCursorOwningComponent(this.textArea); Border emptyBorder = BorderFactory.createEmptyBorder(2, 4, 2, 2); Border grayLineBordre = BorderFactory.createLineBorder(Color.gray, 1); this.textArea.setBorder(BorderFactory.createCompoundBorder(grayLineBordre, emptyBorder)); this.textArea.setSelectionColor(selectionColor); this.textArea.setEditable(true); this.textArea.setLineWrap(true); this.textArea.setWrapStyleWord(true); this.textArea.setText(defaultText); this.textArea.addMouseListener(new PopupListener(this)); // textArea.setFocusable(true); this.textArea.addFocusListener(new TextFocusHandler(this)); this.textArea.getDocument().addDocumentListener(new TextChangedListener(this)); this.textArea.addCaretListener(new CaretChangeHandler(this)); this.undoMgr = new UndoMgr(this); this.textArea.getDocument().addUndoableEditListener(this.undoMgr); } catch (Exception e) { handleException(e); } }
Example 5
Source File: QualitativeColorPalettePanel.java From colorbrewer with GNU Lesser General Public License v2.1 | 6 votes |
protected void buildChooser() { setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); //ButtonGroup boxOfPalettes = new ButtonGroup(); Border border = BorderFactory.createEmptyBorder(2,2,2,2); for (ColorBrewer palette: ColorBrewer.getQualitativeColorPalettes(isShowColorBlindSave())) { if ( isShowColorBlindSave() ){ if (! palette.isColorBlindSave()) { continue; } } JToggleButton button = createPalette(palette, border); //boxOfPalettes.add(button); add(button); currentButtons.add(button); } }
Example 6
Source File: UIUtil.java From audiveris with GNU Affero General Public License v3.0 | 5 votes |
/** * Report a standard tool border entity, which is a blank border. * * @return the standard tool border */ public static Border getToolBorder () { if (toolBorder == null) { toolBorder = BorderFactory.createEmptyBorder(1, 2, 1, 2); } return toolBorder; }
Example 7
Source File: ReportCellRenderer.java From nextreports-designer with Apache License 2.0 | 5 votes |
@Override public Component getRendererComponent(int row, int column, Object value, boolean isSelected, boolean hasFocus, JGrid grid) { super.getRendererComponent(row, column, value, isSelected, hasFocus, grid); BandElement element = (BandElement) value; setText(element.getText()); //if (!isSelected) { setForeground(element.getForeground()); setBackground(element.getBackground()); //} Padding padding = element.getPadding(); Border border = element.getBorder(); if (border != null) { javax.swing.border.Border outer = new CustomLineBorder(border); javax.swing.border.Border inner = null; if (padding != null) { inner = BorderFactory.createEmptyBorder(padding.getTop(), padding.getLeft(), padding.getBottom(), padding.getRight()); } else { inner = BorderFactory.createEmptyBorder(0, 0, 0, 0); } CompoundBorder cBorder = new CompoundBorder(outer, inner); setBorder(cBorder); } else { if (padding != null) { setBorder(BorderFactory.createEmptyBorder(padding.getTop(), padding.getLeft(), padding.getBottom(), padding.getRight())); } } setFont(element.getFont()); setHorizontalAlignment(element.getHorizontalAlign()); setVerticalAlignment(element.getVerticalAlign()); return this; }
Example 8
Source File: AJTextArea.java From egdownloader with GNU General Public License v2.0 | 5 votes |
/** * 可以设置坐标及大小,有边框,可编辑<br> * @param x * @param y * @param width * @param height */ public AJTextArea(String text, int x, int y, int width, int height) { this.setEditable(false); this.setAutoscrolls(true); Border border1 = BorderFactory.createEmptyBorder(5, 5, 5, 5); this.setBorder(border1); this.setText(text); this.setBounds(x, y, width, height); // 下面这行代码是自动滚动的关键代码 this.setLineWrap(true); popup(this); }
Example 9
Source File: JScrollPaneBuilderTest.java From triplea with GNU General Public License v3.0 | 5 votes |
@Test void buildShouldSetBorderWhenProvided() { final Border border = BorderFactory.createEmptyBorder(); final JScrollPane scrollPane = builder.view(new JLabel()).border(border).build(); assertThat(scrollPane.getBorder(), is(sameInstance(border))); }
Example 10
Source File: PageFlowScene.java From netbeans with Apache License 2.0 | 5 votes |
@Override protected void notifyStateChanged(ObjectState previousState, ObjectState state) { Border BORDER_HOVERED = javax.swing.BorderFactory.createLineBorder(java.awt.Color.BLACK); Border BORDER = BorderFactory.createEmptyBorder(); if (previousState.isHovered() == state.isHovered()) { return; } setBorder(state.isHovered() ? BORDER_HOVERED : BORDER); }
Example 11
Source File: VisualConstants.java From chipster with MIT License | 5 votes |
public static UIDefaults getUIDefaults() { //Uncomment to see possible key values //listUIDefaults(); UIDefaults defaults = new UIDefaults(); // The defauls are specified for each look n feel and color theme if(UIManager.getLookAndFeel() instanceof Plastic3DLookAndFeel && Plastic3DLookAndFeel.getPlasticTheme() instanceof ExperienceBlue){ BorderUIResource emptyBorder = new BorderUIResource(BorderFactory.createEmptyBorder()); // Removes borders from menubar defaults.put("MenuBar.border", emptyBorder); defaults.put("SplitPaneDivider.border", emptyBorder); defaults.put("SplitPane.border", emptyBorder); defaults.put(Options.HEADER_STYLE_KEY, HeaderStyle.SINGLE); defaults.put("TaskPane.titleBackgroundGradientStart", UIManager.getColor("Panel.background")); defaults.put("TaskPane.titleBackgroundGradientEnd", UIManager.getColor("Panel.background")); defaults.put("TaskPaneContainer.background", Color.white); defaults.put("SimpleInternalFrame.activeTitleForeground", Color.white); // Adds textarea background to white. This affects for example // help textarea on the top right corner and affymetrix wizard defaults.put("TextArea.background", Color.WHITE); TEXTAREA_UNEDITABLE_BACKGROUND = UIManager.getColor("Panel.background"); } else { // There is no specified look and feel options for this LAF. Use defaults. } return defaults; }
Example 12
Source File: AttributeDropTextField.java From rapidminer-studio with GNU Affero General Public License v3.0 | 5 votes |
public AttributeDropTextField(JTree plotConfigurationTree, DataTableColumnListTransferHandler th, SeriesUsageType type) { th.addDragListener(this); this.setFocusable(false); this.setEditable(false); this.setBackground(Color.white); this.setTransferHandler(new DataTableColumnDropTextFieldTransferHandler(plotConfigurationTree, type, this)); ongoingDropBorder = BorderFactory.createLineBorder(ProcessDrawer.BORDER_DRAG_COLOR, 1); dropEndedBorder = BorderFactory.createEmptyBorder(1, 1, 1, 1); }
Example 13
Source File: JSList.java From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 | 5 votes |
public final void init() { Border border = BorderFactory.createEmptyBorder(pixels, 1, pixels, 1); this.setBorder(BorderFactory.createCompoundBorder(new EmptyBorder(1, 1, 1, 0), border)); this.setLayout(new BorderLayout()); setSize(this.getWidth(), 40); setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); this.setFocusPainted(true); }
Example 14
Source File: ToggleProfilingPointAction.java From netbeans with Apache License 2.0 | 5 votes |
public void setProfilingPointFactory(ProfilingPointFactory ppFactory, int index) { this.ppFactory = ppFactory; if (ppFactory != null) { label.setText(ppFactory.getType()); label.setIcon(ppFactory.getIcon()); } else { label.setText(NO_ACTION_NAME); label.setIcon(NO_ACTION_ICON); } Component selected = null; if ((index >= 0) && (index < previewPanel.getComponentCount())) { selected = previewPanel.getComponent(index); } for (Component c : previewPanel.getComponents()) { if (c == selected) { Border empt1 = BorderFactory.createEmptyBorder(2, 2, 2, 2); Border sel = BorderFactory.createMatteBorder(1, 1, 1, 1, SystemColor.textHighlight); Border empt2 = BorderFactory.createEmptyBorder(0, 2, 0, 2); Border comp1 = BorderFactory.createCompoundBorder(empt2, sel); Border comp2 = BorderFactory.createCompoundBorder(comp1, empt1); ((JComponent) c).setBorder(comp2); } else { ((JComponent) c).setBorder(BorderFactory.createEmptyBorder(3, 5, 3, 5)); } } }
Example 15
Source File: ScreenshotsFrame.java From game-to-philips-hue with GNU General Public License v2.0 | 4 votes |
public ScreenshotsFrame() { super("Lights"); // The the HueSDK singleton. phHueSDK = PHHueSDK.getInstance(); Container content = getContentPane(); // Get the selected bridge. PHBridge bridge = phHueSDK.getSelectedBridge(); // To get lights use the Resource Cache. allLights = bridge.getResourceCache().getAllLights(); JScrollPane listPane = new JScrollPane(lightIdentifiersList); listPane.setPreferredSize(new Dimension(300,100)); JPanel listPanel = new JPanel(); listPanel.setBackground(Color.white); listPanel.add(listPane); content.add(listPanel); // First Area JLabel labelArea1 = new JLabel("Left area light"); labelArea1.setHorizontalAlignment(SwingConstants.CENTER); labelArea1.setBounds(20, 40, 230, 16); content.add(labelArea1); comboBox_area_1.setBounds(20, 60, 230, 27); comboBox_area_1.addItem(""); content.add(comboBox_area_1); color1.setBounds(20, 85, 230, 32); content.add(color1); // Second Area JLabel labelArea2 = new JLabel("Center area light"); labelArea2.setHorizontalAlignment(SwingConstants.CENTER); labelArea2.setBounds(255, 40, 230, 16); content.add(labelArea2); comboBox_area_2.setBounds(255, 60, 230, 27); comboBox_area_2.addItem(""); content.add(comboBox_area_2); color2.setBounds(255, 85, 230, 32); content.add(color2); // Third Area JLabel labelArea3 = new JLabel("Right area light"); labelArea3.setHorizontalAlignment(SwingConstants.CENTER); labelArea3.setBounds(490, 40, 230, 16); content.add(labelArea3); comboBox_area_3.setBounds(490, 60, 230, 27); comboBox_area_3.addItem(""); content.add(comboBox_area_3); color3.setBounds(490, 85, 230, 32); content.add(color3); log.setBounds(490, 60, 230, 32); content.add(log); // Fill lists with lights for (PHLight light : allLights) { comboBox_area_1.addItem(light.getIdentifier() + " " + light.getName() ); comboBox_area_2.addItem(light.getIdentifier() + " " + light.getName() ); comboBox_area_3.addItem(light.getIdentifier() + " " + light.getName() ); } // Start / Stop button changeColourButton.addActionListener(new ScreenshotProcessor()); Border buttonPanelBorder = BorderFactory.createEmptyBorder(); JPanel buttonPanel = new JPanel(); buttonPanel.setBackground(Color.white); buttonPanel.setBorder(buttonPanelBorder); buttonPanel.add(changeColourButton); content.add(buttonPanel, BorderLayout.SOUTH); setPreferredSize(new Dimension(740,400)); pack(); setVisible(true); }
Example 16
Source File: ClosableTabHost.java From SmartIM with Apache License 2.0 | 4 votes |
@Override public Border getBorder() { return BorderFactory.createEmptyBorder(); }
Example 17
Source File: MolStructureViewer.java From mzmine2 with GNU General Public License v2.0 | 4 votes |
/** * Load initial parameters for JPanel * * @param name */ private void setupViewer(String name) { setDefaultCloseOperation(DISPOSE_ON_CLOSE); // Main panel - contains a title (compound name) in the top, 2D // structure on the left, 3D structure on the right JPanel mainPanel = new JPanel(new BorderLayout()); JLabel labelName = new JLabel(name, SwingConstants.CENTER); labelName.setOpaque(true); labelName.setBackground(Color.white); labelName.setForeground(Color.BLUE); Border one = BorderFactory.createEtchedBorder(EtchedBorder.RAISED); Border two = BorderFactory.createEmptyBorder(5, 5, 5, 5); labelName.setBorder(BorderFactory.createCompoundBorder(one, two)); labelName.setFont(new Font("SansSerif", Font.BOLD, 18)); mainPanel.add(labelName, BorderLayout.NORTH); loading2Dlabel = new JLabel("Loading 2D structure...", SwingConstants.CENTER); loading2Dlabel.setOpaque(true); loading2Dlabel.setBackground(Color.white); loading3Dlabel = new JLabel("Loading 3D structure...", SwingConstants.CENTER); loading3Dlabel.setOpaque(true); loading3Dlabel.setBackground(Color.white); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, loading2Dlabel, loading3Dlabel); splitPane.setResizeWeight(0.5); mainPanel.add(splitPane, BorderLayout.CENTER); add(mainPanel); setPreferredSize(new Dimension(900, 500)); // Add the Windows menu JMenuBar menuBar = new JMenuBar(); menuBar.add(new WindowsMenu()); setJMenuBar(menuBar); pack(); // Set the initial splitter location, after the window is packed splitPane.setDividerLocation(500); }
Example 18
Source File: BDDListButton.java From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 | 4 votes |
public final void initDropShadow() { Border border = BorderFactory.createEmptyBorder(pixels, 1, pixels, 1); this.setBorder(BorderFactory.createCompoundBorder(new EmptyBorder(1, 1, 1, 0), border)); this.setLayout(new BorderLayout()); }
Example 19
Source File: TracerOptionsPanel.java From visualvm with GNU General Public License v2.0 | 4 votes |
private static Border titledBorder(String title) { String titleBorder = UIUtils.isWindowsLookAndFeel() ? " " : ""; //NOI18N Border inner = BorderFactory.createEmptyBorder(0, 12, 3, 3); Border outer = BorderFactory.createTitledBorder(titleBorder + title); return BorderFactory.createCompoundBorder(outer, inner); }
Example 20
Source File: GUIUtils.java From mzmine3 with GNU General Public License v2.0 | 2 votes |
/** * Add a margin to a given component * * @param component Component to add the margin to * @param margin Margin size * @return Created border */ public static Border addMargin(JComponent component, int margin) { Border marginBorder = BorderFactory.createEmptyBorder(margin, margin, margin, margin); component.setBorder(marginBorder); return marginBorder; }