List of usage examples for javax.swing BorderFactory createEmptyBorder
public static Border createEmptyBorder()
From source file:Main.java
public static void main(String[] argv) { EmptyBorder emptyBorder = (EmptyBorder) BorderFactory.createEmptyBorder(); JLabel component = new JLabel("label"); component.setBorder(emptyBorder);//www .j a va 2 s .c o m }
From source file:Main.java
/** * Returns a new JScrollPane with the specified component and with an empty border. * * @param component the component to add to the scroll pane. * @return a new scroll pane./*from w w w. j a v a 2 s .c om*/ */ public static JScrollPane borderlessScrollPane(final Component component) { JScrollPane pane = new JScrollPane(component); pane.setBorder(BorderFactory.createEmptyBorder()); return pane; }
From source file:com.clank.launcher.Launcher.java
/** * Bootstrap.//from ww w . j a va 2 s .co m * * @param args args */ public static void main(String[] args) { SimpleLogFormatter.configureGlobalLogger(); LauncherArguments options = new LauncherArguments(); try { new JCommander(options, args); } catch (ParameterException e) { System.err.print(e.getMessage()); System.exit(1); return; } Integer bsVersion = options.getBootstrapVersion(); log.info(bsVersion != null ? "Bootstrap version " + bsVersion + " detected" : "Not bootstrapped"); File dir = options.getDir(); if (dir != null) { log.info("Using given base directory " + dir.getAbsolutePath()); } else { dir = new File("."); log.info("Using current directory " + dir.getAbsolutePath()); } final File baseDir = dir; SwingUtilities.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); UIManager.getDefaults().put("SplitPane.border", BorderFactory.createEmptyBorder()); Launcher launcher = new Launcher(baseDir); new LauncherFrame(launcher).setVisible(true); } catch (Throwable t) { log.log(Level.WARNING, "Load failure", t); SwingHelper.showErrorDialog(null, "Uh oh! The updater couldn't be opened because a " + "problem was encountered.", "Launcher error", t); } } }); }
From source file:Main.java
public static JPanel createFlow(final int align, final int gap, final Object... components) { final JPanel jp = new JPanel(new FlowLayout(align, gap, gap)); jp.setBorder(BorderFactory.createEmptyBorder()); for (final Object component : components) { if (component instanceof Component) { initComponentHeight((Component) component); jp.add((Component) component); } else if (component instanceof Number) { jp.add(Box.createHorizontalStrut(((Number) component).intValue())); }/* w w w . java 2 s . c om*/ } return jp; }
From source file:Main.java
/** * Initializes a default margin in provided directions. * <p>/* w ww . j a va2s . c o m*/ * Directions provided can be one of the TOP, LEFT, DOWN and BOTTOM * constants from the {@link SwingConstants} interface. * * @param directions Array of directions where the border is to be created. * @return Empty border to be used as margin; border width defined as * {@link #DEFAULT_MARGIN}. */ public static Border defaultMargin(int... directions) { int[] borders = new int[4]; if (directions == null) return BorderFactory.createEmptyBorder(); for (int i = 0; i < directions.length; i++) { if (directions[i] == SwingConstants.TOP) borders[0] = DEFAULT_MARGIN; if (directions[i] == SwingConstants.LEFT) borders[1] = DEFAULT_MARGIN; if (directions[i] == SwingConstants.BOTTOM) borders[2] = DEFAULT_MARGIN; if (directions[i] == SwingConstants.RIGHT) borders[3] = DEFAULT_MARGIN; } return BorderFactory.createEmptyBorder(borders[0], borders[1], borders[2], borders[3]); }
From source file:Main.java
public static void displayEditorPaneWithNoBorderAndTranslucent(JEditorPane editorPane) { editorPane.setOpaque(false);//from ww w . j a v a 2s .c om editorPane.setBorder(null); editorPane.setBorder(BorderFactory.createEmptyBorder()); editorPane.setBackground(new Color(0, 0, 0, 0)); }
From source file:Main.java
public Main(String name) { getContentPane().setLayout(new FlowLayout()); JLabel labelTwo = new JLabel("www.java2s.com"); labelTwo.setBorder(BorderFactory.createEmptyBorder()); add(labelTwo);//from ww w.j av a2 s.c o m JLabel labelThree = new JLabel("MatteBorder"); labelThree.setBorder(BorderFactory.createMatteBorder(10, 10, 10, 10, Color.pink)); add(labelThree); JLabel labelFour = new JLabel("TitledBorder"); labelFour.setBorder( BorderFactory.createTitledBorder(BorderFactory.createMatteBorder(10, 10, 10, 10, Color.pink), "Title", TitledBorder.RIGHT, TitledBorder.BOTTOM)); add(labelFour); JLabel labelSix = new JLabel("CompoundBorder"); Border one = BorderFactory.createEtchedBorder(); Border two = BorderFactory.createMatteBorder(4, 4, 4, 4, Color.blue); labelSix.setBorder(BorderFactory.createCompoundBorder(one, two)); add(labelSix); }
From source file:BorderTest.java
public BorderTest() { JPanel p = new JPanel(); Border[] border = new Border[] { BorderFactory.createEtchedBorder(), BorderFactory.createTitledBorder("Border types"), BorderFactory.createLoweredBevelBorder(), BorderFactory.createRaisedBevelBorder(), BorderFactory.createEtchedBorder(), BorderFactory.createLineBorder(Color.blue), BorderFactory.createMatteBorder(10, 10, 10, 10, Color.blue), BorderFactory.createEmptyBorder() };/*w ww . j a v a 2 s . c o m*/ p.setLayout(new GridLayout(border.length, 0, 3, 3)); for (int i = 0; i < border.length; i++) { JPanel borderPanel = new JPanel(); borderPanel.setBorder(border[i]); p.add(borderPanel); } getContentPane().add(p, "Center"); setTitle("BorderTest"); setSize(600, 400); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); }
From source file:Main.java
@Override public void updateUI() { super.updateUI(); UIManager.put("ComboBox.squareButton", Boolean.FALSE); setUI(new BasicComboBoxUI() { @Override//from w w w .ja v a 2 s. c o m protected JButton createArrowButton() { JButton b = new JButton(); b.setBorder(BorderFactory.createEmptyBorder()); b.setVisible(false); return b; } }); setBorder(BorderFactory.createLineBorder(Color.GRAY)); }
From source file:Main.java
public MyCloseButton() { super("x"); setBorder(BorderFactory.createEmptyBorder()); setFocusPainted(false);/*from w ww . ja va 2s. c o m*/ setBorderPainted(false); setContentAreaFilled(false); setRolloverEnabled(false); }