Java Code Examples for javax.swing.JPanel#setLocation()

The following examples show how to use javax.swing.JPanel#setLocation() . 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: CursorOverlappedPanelsTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static JPanel createPanel(Point location, boolean enabled) {
    final JPanel panel = new JPanel();
    panel.setOpaque(false);
    panel.setEnabled(enabled);
    panel.setSize(new Dimension(200, 200));
    panel.setLocation(location);
    panel.setBorder(BorderFactory.createTitledBorder(
            enabled ? "Enabled" : "Disabled"));
    panel.setCursor(Cursor.getPredefinedCursor(
            enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    return panel;
}
 
Example 2
Source File: javax_swing_JLayeredPane.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static void init(JLayeredPane pane, int layer, int x, int y, int w, int h, Color color) {
    JPanel panel = new JPanel();
    panel.setBackground(color);
    panel.setLocation(x, y);
    panel.setSize(w, h);
    pane.add(panel, new Integer(layer));
}
 
Example 3
Source File: CursorOverlappedPanelsTest.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static JPanel createPanel(Point location, boolean enabled) {
    final JPanel panel = new JPanel();
    panel.setOpaque(false);
    panel.setEnabled(enabled);
    panel.setSize(new Dimension(200, 200));
    panel.setLocation(location);
    panel.setBorder(BorderFactory.createTitledBorder(
            enabled ? "Enabled" : "Disabled"));
    panel.setCursor(Cursor.getPredefinedCursor(
            enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    return panel;
}
 
Example 4
Source File: javax_swing_JLayeredPane.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void init(JLayeredPane pane, int layer, int x, int y, int w, int h, Color color) {
    JPanel panel = new JPanel();
    panel.setBackground(color);
    panel.setLocation(x, y);
    panel.setSize(w, h);
    pane.add(panel, new Integer(layer));
}
 
Example 5
Source File: CursorOverlappedPanelsTest.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static JPanel createPanel(Point location, boolean enabled) {
    final JPanel panel = new JPanel();
    panel.setOpaque(false);
    panel.setEnabled(enabled);
    panel.setSize(new Dimension(200, 200));
    panel.setLocation(location);
    panel.setBorder(BorderFactory.createTitledBorder(
            enabled ? "Enabled" : "Disabled"));
    panel.setCursor(Cursor.getPredefinedCursor(
            enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    return panel;
}
 
Example 6
Source File: GraphCanvas.java    From moa with GNU General Public License v3.0 5 votes vote down vote up
private void addComponents() {

        axesPanel = new GraphAxes();
        curvePanel = new GraphCurve();
        eventPanel = new JPanel();

        curvePanel.setLocation(x_offset_left + 1, y_offset_top);
        eventPanel.setLocation(x_offset_left + 1, 0);
        eventPanel.setLayout(null);

        add(axesPanel);
        axesPanel.add(curvePanel);
        axesPanel.add(eventPanel);

    }
 
Example 7
Source File: CursorOverlappedPanelsTest.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static JPanel createPanel(Point location, boolean enabled) {
    final JPanel panel = new JPanel();
    panel.setOpaque(false);
    panel.setEnabled(enabled);
    panel.setSize(new Dimension(200, 200));
    panel.setLocation(location);
    panel.setBorder(BorderFactory.createTitledBorder(
            enabled ? "Enabled" : "Disabled"));
    panel.setCursor(Cursor.getPredefinedCursor(
            enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    return panel;
}
 
Example 8
Source File: CursorOverlappedPanelsTest.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static JPanel createPanel(Point location, boolean enabled) {
    final JPanel panel = new JPanel();
    panel.setOpaque(false);
    panel.setEnabled(enabled);
    panel.setSize(new Dimension(200, 200));
    panel.setLocation(location);
    panel.setBorder(BorderFactory.createTitledBorder(
            enabled ? "Enabled" : "Disabled"));
    panel.setCursor(Cursor.getPredefinedCursor(
            enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    return panel;
}
 
Example 9
Source File: CursorOverlappedPanelsTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static JPanel createPanel(Point location, boolean enabled) {
    final JPanel panel = new JPanel();
    panel.setOpaque(false);
    panel.setEnabled(enabled);
    panel.setSize(new Dimension(200, 200));
    panel.setLocation(location);
    panel.setBorder(BorderFactory.createTitledBorder(
            enabled ? "Enabled" : "Disabled"));
    panel.setCursor(Cursor.getPredefinedCursor(
            enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    return panel;
}
 
Example 10
Source File: javax_swing_JLayeredPane.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static void init(JLayeredPane pane, int layer, int x, int y, int w, int h, Color color) {
    JPanel panel = new JPanel();
    panel.setBackground(color);
    panel.setLocation(x, y);
    panel.setSize(w, h);
    pane.add(panel, new Integer(layer));
}
 
Example 11
Source File: CursorOverlappedPanelsTest.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static JPanel createPanel(Point location, boolean enabled) {
    final JPanel panel = new JPanel();
    panel.setOpaque(false);
    panel.setEnabled(enabled);
    panel.setSize(new Dimension(200, 200));
    panel.setLocation(location);
    panel.setBorder(BorderFactory.createTitledBorder(
            enabled ? "Enabled" : "Disabled"));
    panel.setCursor(Cursor.getPredefinedCursor(
            enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    return panel;
}
 
Example 12
Source File: javax_swing_JLayeredPane.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static void init(JLayeredPane pane, int layer, int x, int y, int w, int h, Color color) {
    JPanel panel = new JPanel();
    panel.setBackground(color);
    panel.setLocation(x, y);
    panel.setSize(w, h);
    pane.add(panel, new Integer(layer));
}
 
Example 13
Source File: SplashScreen.java    From chipster with MIT License 5 votes vote down vote up
public SplashScreen(Icon icon) {
	frame = new JFrame();
	frame.setLayout(null);
	frame.setUndecorated(true);		
	frame.setSize(icon.getIconWidth(), icon.getIconHeight()+TEXT_HEIGHT);
	frame.setLocationRelativeTo(null);  
	frame.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
	frame.getRootPane().setBorder(new LineBorder(VisualConstants.SPLASH_BORDER_COLOR, 1));
	
	JLabel imageLabel = new JLabel(icon);
	imageLabel.setSize(icon.getIconWidth(), icon.getIconHeight());
	frame.add(imageLabel);
	imageLabel.setLocation(0, 0);
	textLabel = new JLabel();
	textLabel.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));
	
	textLabel.setFont(VisualConstants.SPLASH_SCREEN_FONT);
	
	textPanel = new JPanel(new BorderLayout());
	textPanel.setLocation(0, icon.getIconHeight());
	textPanel.setSize(icon.getIconWidth(), TEXT_HEIGHT);
	textPanel.setBackground(Color.WHITE);
	textPanel.setOpaque(true);
	textPanel.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, VisualConstants.SPLASH_BORDER_COLOR));
	textPanel.add(textLabel);
	
	frame.add(textPanel);
	frame.setVisible(true);
}
 
Example 14
Source File: javax_swing_JLayeredPane.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static void init(JLayeredPane pane, int layer, int x, int y, int w, int h, Color color) {
    JPanel panel = new JPanel();
    panel.setBackground(color);
    panel.setLocation(x, y);
    panel.setSize(w, h);
    pane.add(panel, new Integer(layer));
}
 
Example 15
Source File: CursorOverlappedPanelsTest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static JPanel createPanel(Point location, boolean enabled) {
    final JPanel panel = new JPanel();
    panel.setOpaque(false);
    panel.setEnabled(enabled);
    panel.setSize(new Dimension(200, 200));
    panel.setLocation(location);
    panel.setBorder(BorderFactory.createTitledBorder(
            enabled ? "Enabled" : "Disabled"));
    panel.setCursor(Cursor.getPredefinedCursor(
            enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    return panel;
}
 
Example 16
Source File: javax_swing_JLayeredPane.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private static void init(JLayeredPane pane, int layer, int x, int y, int w, int h, Color color) {
    JPanel panel = new JPanel();
    panel.setBackground(color);
    panel.setLocation(x, y);
    panel.setSize(w, h);
    pane.add(panel, new Integer(layer));
}
 
Example 17
Source File: CursorOverlappedPanelsTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static JPanel createPanel(Point location, boolean enabled) {
    final JPanel panel = new JPanel();
    panel.setOpaque(false);
    panel.setEnabled(enabled);
    panel.setSize(new Dimension(200, 200));
    panel.setLocation(location);
    panel.setBorder(BorderFactory.createTitledBorder(
            enabled ? "Enabled" : "Disabled"));
    panel.setCursor(Cursor.getPredefinedCursor(
            enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    return panel;
}
 
Example 18
Source File: javax_swing_JLayeredPane.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static void init(JLayeredPane pane, int layer, int x, int y, int w, int h, Color color) {
    JPanel panel = new JPanel();
    panel.setBackground(color);
    panel.setLocation(x, y);
    panel.setSize(w, h);
    pane.add(panel, new Integer(layer));
}
 
Example 19
Source File: CursorOverlappedPanelsTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static JPanel createPanel(Point location, boolean enabled) {
    final JPanel panel = new JPanel();
    panel.setOpaque(false);
    panel.setEnabled(enabled);
    panel.setSize(new Dimension(200, 200));
    panel.setLocation(location);
    panel.setBorder(BorderFactory.createTitledBorder(
            enabled ? "Enabled" : "Disabled"));
    panel.setCursor(Cursor.getPredefinedCursor(
            enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    return panel;
}
 
Example 20
Source File: CursorOverlappedPanelsTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static JPanel createPanel(Point location, boolean enabled) {
    final JPanel panel = new JPanel();
    panel.setOpaque(false);
    panel.setEnabled(enabled);
    panel.setSize(new Dimension(200, 200));
    panel.setLocation(location);
    panel.setBorder(BorderFactory.createTitledBorder(
            enabled ? "Enabled" : "Disabled"));
    panel.setCursor(Cursor.getPredefinedCursor(
            enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
    return panel;
}