本文整理匯總了Java中java.awt.Frame.toFront方法的典型用法代碼示例。如果您正苦於以下問題:Java Frame.toFront方法的具體用法?Java Frame.toFront怎麽用?Java Frame.toFront使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.awt.Frame
的用法示例。
在下文中一共展示了Frame.toFront方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: main
import java.awt.Frame; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
Frame sourceFrame = createFrame("Source Frame", 0, 0);
Frame targetFrame = createFrame("Target Frame", 250, 250);
DragSource defaultDragSource
= DragSource.getDefaultDragSource();
defaultDragSource.createDefaultDragGestureRecognizer(sourceFrame,
DnDConstants.ACTION_COPY_OR_MOVE,
new TestDragGestureListener());
new DropTarget(targetFrame, DnDConstants.ACTION_COPY_OR_MOVE,
new TestDropTargetListener(targetFrame));
Robot robot = new Robot();
robot.setAutoDelay(50);
sourceFrame.toFront();
robot.waitForIdle();
Point point = getCenterPoint(sourceFrame);
robot.mouseMove(point.x, point.y);
robot.waitForIdle();
mouseDragAndDrop(robot, point, getCenterPoint(targetFrame));
long time = System.currentTimeMillis() + 200;
while (!passed) {
if (time < System.currentTimeMillis()) {
sourceFrame.dispose();
targetFrame.dispose();
throw new RuntimeException("Mouse clicked event is lost!");
}
Thread.sleep(10);
}
sourceFrame.dispose();
targetFrame.dispose();
}
示例2: frontMainWindow
import java.awt.Frame; //導入方法依賴的package包/類
private static void frontMainWindow() {
Frame f = WindowManager.getDefault().getMainWindow();
// makes sure the frame is visible
f.setVisible(true);
// uniconifies the frame if it is inconified
if ((f.getExtendedState() & Frame.ICONIFIED) != 0) {
f.setExtendedState(~Frame.ICONIFIED & f.getExtendedState());
}
// moves it to front and requests focus
f.toFront ();
}
示例3: SharedMemoryPixmapsTest
import java.awt.Frame; //導入方法依賴的package包/類
/** Creates a new instance of SharedMemoryPixmapsTest */
public SharedMemoryPixmapsTest() {
testFrame = new Frame("SharedMemoryPixmapsTest");
testFrame.add(new TestComponent());
testFrame.setUndecorated(true);
testFrame.setResizable(false);
testFrame.pack();
testFrame.setLocationRelativeTo(null);
testFrame.setVisible(true);
testFrame.toFront();
}
示例4: runTest
import java.awt.Frame; //導入方法依賴的package包/類
private static void runTest() throws Exception {
Frame sourceFrame = createFrame("Source Frame", 100, 100);
Frame targetFrame = createFrame("Target Frame", 350, 350);
DragSource defaultDragSource
= DragSource.getDefaultDragSource();
defaultDragSource.createDefaultDragGestureRecognizer(sourceFrame,
DnDConstants.ACTION_COPY_OR_MOVE,
new TestDragGestureListener());
new DropTarget(targetFrame, DnDConstants.ACTION_COPY_OR_MOVE,
new TestDropTargetListener(targetFrame));
Robot robot = new Robot();
robot.setAutoDelay(50);
sourceFrame.toFront();
robot.waitForIdle();
Point point = getCenterPoint(sourceFrame);
robot.mouseMove(point.x, point.y);
robot.waitForIdle();
mouseDragAndDrop(robot, point, getCenterPoint(targetFrame));
long time = System.currentTimeMillis() + 1000;
while (!passed) {
if (time < System.currentTimeMillis()) {
sourceFrame.dispose();
targetFrame.dispose();
throw new RuntimeException("Mouse clicked event is lost!");
}
Thread.sleep(10);
}
sourceFrame.dispose();
targetFrame.dispose();
}
示例5: createGUI
import java.awt.Frame; //導入方法依賴的package包/類
public void createGUI() {
frame = new Frame();
frame.setTitle("ExtendedModifiersTest");
frame.setLayout(new GridLayout(1, 6));
button = new Button();
button.addKeyListener(this);
frame.add(button);
buttonLW = new LWButton();
buttonLW.addKeyListener(this);
frame.add(buttonLW);
textField = new TextField(5);
textField.addKeyListener(this);
frame.add(textField);
textArea = new TextArea(5, 5);
textArea.addKeyListener(this);
frame.add(textArea);
list = new List();
for (int i = 1; i <= 5; ++i) {
list.add("item " + i);
}
list.addKeyListener(this);
frame.add(list);
listLW = new LWList();
for (int i = 1; i <= 5; ++i) {
listLW.add("item " + i);
}
listLW.addKeyListener(this);
frame.add(listLW);
frame.setBackground(Color.gray);
frame.setSize(500, 100);
frame.setVisible(true);
frame.toFront();
}