Java Code Examples for javax.swing.border.TitledBorder#getBorderInsets()
The following examples show how to use
javax.swing.border.TitledBorder#getBorderInsets() .
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: Test7034614.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) { Graphics g = new BufferedImage(9, 9, 9).getGraphics(); BrokenBorder broken = new BrokenBorder(); TitledBorder titled = new TitledBorder(broken, broken.getClass().getName()); Insets insets = (Insets) broken.getBorderInsets(broken).clone(); titled.getBorderInsets(broken); broken.validate(insets); for (int i = 0; i < 10; i++) { titled.paintBorder(broken, g, 0, 0, i, i); broken.validate(insets); titled.getBaseline(broken, i, i); broken.validate(insets); } }
Example 2
Source File: Test7034614.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) { Graphics g = new BufferedImage(9, 9, 9).getGraphics(); BrokenBorder broken = new BrokenBorder(); TitledBorder titled = new TitledBorder(broken, broken.getClass().getName()); Insets insets = (Insets) broken.getBorderInsets(broken).clone(); titled.getBorderInsets(broken); broken.validate(insets); for (int i = 0; i < 10; i++) { titled.paintBorder(broken, g, 0, 0, i, i); broken.validate(insets); titled.getBaseline(broken, i, i); broken.validate(insets); } }
Example 3
Source File: Test7034614.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) { Graphics g = new BufferedImage(9, 9, 9).getGraphics(); BrokenBorder broken = new BrokenBorder(); TitledBorder titled = new TitledBorder(broken, broken.getClass().getName()); Insets insets = (Insets) broken.getBorderInsets(broken).clone(); titled.getBorderInsets(broken); broken.validate(insets); for (int i = 0; i < 10; i++) { titled.paintBorder(broken, g, 0, 0, i, i); broken.validate(insets); titled.getBaseline(broken, i, i); broken.validate(insets); } }
Example 4
Source File: Test7034614.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) { Graphics g = new BufferedImage(9, 9, 9).getGraphics(); BrokenBorder broken = new BrokenBorder(); TitledBorder titled = new TitledBorder(broken, broken.getClass().getName()); Insets insets = (Insets) broken.getBorderInsets(broken).clone(); titled.getBorderInsets(broken); broken.validate(insets); for (int i = 0; i < 10; i++) { titled.paintBorder(broken, g, 0, 0, i, i); broken.validate(insets); titled.getBaseline(broken, i, i); broken.validate(insets); } }
Example 5
Source File: Test7034614.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) { Graphics g = new BufferedImage(9, 9, 9).getGraphics(); BrokenBorder broken = new BrokenBorder(); TitledBorder titled = new TitledBorder(broken, broken.getClass().getName()); Insets insets = (Insets) broken.getBorderInsets(broken).clone(); titled.getBorderInsets(broken); broken.validate(insets); for (int i = 0; i < 10; i++) { titled.paintBorder(broken, g, 0, 0, i, i); broken.validate(insets); titled.getBaseline(broken, i, i); broken.validate(insets); } }
Example 6
Source File: Test7034614.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) { Graphics g = new BufferedImage(9, 9, 9).getGraphics(); BrokenBorder broken = new BrokenBorder(); TitledBorder titled = new TitledBorder(broken, broken.getClass().getName()); Insets insets = (Insets) broken.getBorderInsets(broken).clone(); titled.getBorderInsets(broken); broken.validate(insets); for (int i = 0; i < 10; i++) { titled.paintBorder(broken, g, 0, 0, i, i); broken.validate(insets); titled.getBaseline(broken, i, i); broken.validate(insets); } }
Example 7
Source File: Test7034614.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) { Graphics g = new BufferedImage(9, 9, 9).getGraphics(); BrokenBorder broken = new BrokenBorder(); TitledBorder titled = new TitledBorder(broken, broken.getClass().getName()); Insets insets = (Insets) broken.getBorderInsets(broken).clone(); titled.getBorderInsets(broken); broken.validate(insets); for (int i = 0; i < 10; i++) { titled.paintBorder(broken, g, 0, 0, i, i); broken.validate(insets); titled.getBaseline(broken, i, i); broken.validate(insets); } }
Example 8
Source File: Test7034614.java From hottub with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) { Graphics g = new BufferedImage(9, 9, 9).getGraphics(); BrokenBorder broken = new BrokenBorder(); TitledBorder titled = new TitledBorder(broken, broken.getClass().getName()); Insets insets = (Insets) broken.getBorderInsets(broken).clone(); titled.getBorderInsets(broken); broken.validate(insets); for (int i = 0; i < 10; i++) { titled.paintBorder(broken, g, 0, 0, i, i); broken.validate(insets); titled.getBaseline(broken, i, i); broken.validate(insets); } }
Example 9
Source File: Test7034614.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) { Graphics g = new BufferedImage(9, 9, 9).getGraphics(); BrokenBorder broken = new BrokenBorder(); TitledBorder titled = new TitledBorder(broken, broken.getClass().getName()); Insets insets = (Insets) broken.getBorderInsets(broken).clone(); titled.getBorderInsets(broken); broken.validate(insets); for (int i = 0; i < 10; i++) { titled.paintBorder(broken, g, 0, 0, i, i); broken.validate(insets); titled.getBaseline(broken, i, i); broken.validate(insets); } }
Example 10
Source File: Test7034614.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) { Graphics g = new BufferedImage(9, 9, 9).getGraphics(); BrokenBorder broken = new BrokenBorder(); TitledBorder titled = new TitledBorder(broken, broken.getClass().getName()); Insets insets = (Insets) broken.getBorderInsets(broken).clone(); titled.getBorderInsets(broken); broken.validate(insets); for (int i = 0; i < 10; i++) { titled.paintBorder(broken, g, 0, 0, i, i); broken.validate(insets); titled.getBaseline(broken, i, i); broken.validate(insets); } }
Example 11
Source File: Test7034614.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) { Graphics g = new BufferedImage(9, 9, 9).getGraphics(); BrokenBorder broken = new BrokenBorder(); TitledBorder titled = new TitledBorder(broken, broken.getClass().getName()); Insets insets = (Insets) broken.getBorderInsets(broken).clone(); titled.getBorderInsets(broken); broken.validate(insets); for (int i = 0; i < 10; i++) { titled.paintBorder(broken, g, 0, 0, i, i); broken.validate(insets); titled.getBaseline(broken, i, i); broken.validate(insets); } }
Example 12
Source File: Test7034614.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) { Graphics g = new BufferedImage(9, 9, 9).getGraphics(); BrokenBorder broken = new BrokenBorder(); TitledBorder titled = new TitledBorder(broken, broken.getClass().getName()); Insets insets = (Insets) broken.getBorderInsets(broken).clone(); titled.getBorderInsets(broken); broken.validate(insets); for (int i = 0; i < 10; i++) { titled.paintBorder(broken, g, 0, 0, i, i); broken.validate(insets); titled.getBaseline(broken, i, i); broken.validate(insets); } }
Example 13
Source File: Test7034614.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) { Graphics g = new BufferedImage(9, 9, 9).getGraphics(); BrokenBorder broken = new BrokenBorder(); TitledBorder titled = new TitledBorder(broken, broken.getClass().getName()); Insets insets = (Insets) broken.getBorderInsets(broken).clone(); titled.getBorderInsets(broken); broken.validate(insets); for (int i = 0; i < 10; i++) { titled.paintBorder(broken, g, 0, 0, i, i); broken.validate(insets); titled.getBaseline(broken, i, i); broken.validate(insets); } }
Example 14
Source File: MainPanel.java From java-swing-tips with MIT License | 5 votes |
private MainPanel() { super(new GridLayout(1, 2, 5, 5)); JPanel panel1 = new JPanel() { private final JLabel label = new JLabel(); @Override public String getToolTipText(MouseEvent e) { Border b = getBorder(); if (b instanceof TitledBorder) { // int edge = 2; // EDGE_SPACING; TitledBorder titledBorder = (TitledBorder) b; Insets i = titledBorder.getBorderInsets(this); String title = titledBorder.getTitle(); label.setFont(titledBorder.getTitleFont()); label.setText(title); Dimension size = label.getPreferredSize(); int labelX = i.left; int labelY = 0; int labelW = getSize().width - i.left - i.right; int labelH = i.top; if (size.width > labelW) { Rectangle r = new Rectangle(labelX, labelY, labelW, labelH); return r.contains(e.getPoint()) ? title : null; } } return null; // super.getToolTipText(e); } }; panel1.setBorder(BorderFactory.createTitledBorder("Override JPanel#getToolTipText(...)")); panel1.setToolTipText("JPanel: dummy"); JPanel panel2 = new JPanel(); panel2.setBorder(BorderFactory.createTitledBorder("Default TitledBorder on JPanel")); panel2.setToolTipText("JPanel"); setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); add(panel1); add(panel2); setPreferredSize(new Dimension(320, 240)); }