下面列出了javax.swing.JPanel#setLocation ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
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;
}
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;
}
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;
}
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));
}
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;
}
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));
}
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;
}
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));
}
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);
}
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));
}
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;
}
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));
}
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;
}
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;
}
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;
}
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);
}
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;
}
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));
}
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;
}
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));
}