use of java.awt.BorderLayout in project jdk8u_jdk by JetBrains.
the class ExtraMouseClick method init.
public void init() {
this.setLayout(new BorderLayout());
frame.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
System.out.println("MousePressed");
pressed = true;
}
public void mouseReleased(MouseEvent e) {
System.out.println("MouseReleased");
released = true;
}
public void mouseClicked(MouseEvent e) {
System.out.println("MouseClicked!!!!");
clicked = true;
}
});
frame.addMouseMotionListener(new MouseMotionAdapter() {
public void mouseDragged(MouseEvent e) {
System.out.println("MouseDragged--" + e);
dragged = true;
}
public void mouseMoved(MouseEvent e) {
}
});
}
use of java.awt.BorderLayout in project jdk8u_jdk by JetBrains.
the class TexturePaintPrintingTest method doTest.
private static void doTest(Runnable action) {
String description = " A TexturePaint graphics will be shown on console.\n" + " The same graphics is sent to printer.\n" + " Please verify if TexturePaint shading is printed.\n" + " If none is printed, press FAIL else press PASS";
final JDialog dialog = new JDialog();
dialog.setTitle("printSelectionTest");
JTextArea textArea = new JTextArea(description);
textArea.setEditable(false);
final JButton testButton = new JButton("Start Test");
final JButton passButton = new JButton("PASS");
passButton.setEnabled(false);
passButton.addActionListener((e) -> {
f.dispose();
dialog.dispose();
pass();
});
final JButton failButton = new JButton("FAIL");
failButton.setEnabled(false);
failButton.addActionListener((e) -> {
f.dispose();
dialog.dispose();
fail();
});
testButton.addActionListener((e) -> {
testButton.setEnabled(false);
action.run();
passButton.setEnabled(true);
failButton.setEnabled(true);
});
JPanel mainPanel = new JPanel(new BorderLayout());
mainPanel.add(textArea, BorderLayout.CENTER);
JPanel buttonPanel = new JPanel(new FlowLayout());
buttonPanel.add(testButton);
buttonPanel.add(passButton);
buttonPanel.add(failButton);
mainPanel.add(buttonPanel, BorderLayout.SOUTH);
dialog.add(mainPanel);
dialog.pack();
dialog.setVisible(true);
dialog.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
System.out.println("main dialog closing");
testGeneratedInterrupt = false;
mainThread.interrupt();
}
});
}
use of java.awt.BorderLayout in project jdk8u_jdk by JetBrains.
the class GifTransparencyTest method show.
public void show() {
JPanel p = new JPanel(new BorderLayout()) {
public void paintComponent(Graphics g) {
g.setColor(Color.blue);
g.fillRect(0, 0, getWidth(), getHeight());
}
};
p.add(new ImageComponent(src), BorderLayout.WEST);
if (dst != null) {
p.add(new ImageComponent(dst), BorderLayout.EAST);
}
JFrame f = new JFrame("Transparency");
f.add(p);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.pack();
f.setVisible(true);
}
use of java.awt.BorderLayout in project jdk8u_jdk by JetBrains.
the class TSFrame method createGui.
public static Frame createGui(final boolean useSwing, final boolean useShape, final boolean useTransl, final boolean useNonOpaque, final float factor) {
Frame frame;
done = false;
if (useNonOpaque) {
if (useSwing) {
frame = new NonOpaqueJFrame();
// frame = new NonOpaqueJAppletFrame(gc);
} else {
frame = new NonOpaqueFrame();
}
animateComponent(frame);
} else if (useSwing) {
frame = new JFrame("Swing Frame");
JComponent p = new JButton("Swing!");
p.setPreferredSize(new Dimension(200, 100));
frame.add("North", p);
p = new MyJPanel();
animateComponent(p);
frame.add("Center", p);
} else {
frame = new Frame("AWT Frame") {
public void paint(Graphics g) {
g.setColor(Color.red);
g.fillRect(0, 0, 100, 100);
}
};
frame.setLayout(new BorderLayout());
Canvas c = new MyCanvas();
frame.add("North", c);
animateComponent(c);
c = new MyCanvas();
frame.add("Center", c);
animateComponent(c);
c = new MyCanvas();
frame.add("South", c);
animateComponent(c);
}
final Frame finalFrame = frame;
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
finalFrame.dispose();
done = true;
}
});
frame.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
finalFrame.dispose();
done = true;
}
});
frame.setPreferredSize(new Dimension(800, 600));
if (useShape) {
frame.setUndecorated(true);
}
frame.setLocation(450, 10);
frame.pack();
GraphicsDevice gd = frame.getGraphicsConfiguration().getDevice();
if (useShape) {
if (gd.isWindowTranslucencySupported(WindowTranslucency.PERPIXEL_TRANSPARENT)) {
System.out.println("applying PERPIXEL_TRANSPARENT");
frame.setShape(new Ellipse2D.Double(0, 0, frame.getWidth(), frame.getHeight() / 3));
frame.setTitle("PERPIXEL_TRANSPARENT");
} else {
System.out.println("Passed: PERPIXEL_TRANSPARENT unsupported");
}
}
if (useTransl) {
if (gd.isWindowTranslucencySupported(WindowTranslucency.TRANSLUCENT)) {
System.out.println("applying TRANSLUCENT");
frame.setOpacity(factor);
frame.setTitle("TRANSLUCENT");
} else {
System.out.println("Passed: TRANSLUCENT unsupported");
}
}
if (useNonOpaque) {
if (gd.isWindowTranslucencySupported(WindowTranslucency.PERPIXEL_TRANSLUCENT)) {
System.out.println("applying PERPIXEL_TRANSLUCENT");
frame.setBackground(new Color(0, 0, 0, 0));
frame.setTitle("PERPIXEL_TRANSLUCENT");
} else {
System.out.println("Passed: PERPIXEL_TRANSLUCENT unsupported");
}
}
frame.setVisible(true);
return frame;
}
use of java.awt.BorderLayout in project jdk8u_jdk by JetBrains.
the class java_awt_BorderLayout method getAnotherObject.
@Override
protected BorderLayout getAnotherObject() {
BorderLayout layout = getObject();
update(layout, BorderLayout.CENTER);
return layout;
}
Aggregations