本文整理汇总了Java中javax.swing.JFrame.toFront方法的典型用法代码示例。如果您正苦于以下问题:Java JFrame.toFront方法的具体用法?Java JFrame.toFront怎么用?Java JFrame.toFront使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JFrame
的用法示例。
在下文中一共展示了JFrame.toFront方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: show
import javax.swing.JFrame; //导入方法依赖的package包/类
/** Make the frame visible, non-iconized, and focused. */
public static void show(JFrame frame) {
frame.setVisible(true);
frame.setExtendedState(frame.getExtendedState() & ~JFrame.ICONIFIED);
frame.requestFocus();
frame.toFront();
}
示例2: displayCalibrationStatus
import javax.swing.JFrame; //导入方法依赖的package包/类
@Override
protected void displayCalibrationStatus(JFrame frame) throws Exception {
CalibrationStatusDisplay calibDisplay =
new CalibrationStatusDisplay(frame, calibrationPoints,new java.awt.geom.Point2D.Double[9]);
frame.setMinimumSize(new Dimension(600,300));
frame.add(calibDisplay);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
frame.setVisible(true);
frame.setTitle("Calibration: "+new Date());
Insets insets = frame.getInsets();
int width = frame.getSize().width-(insets.left+insets.right);
int height = frame.getSize().height-(insets.top+insets.bottom);
calibDisplay.windowDimension = new Dimension(width,height);
frame.toFront();
calibDisplay.repaint();
}
示例3: demoMenu
import javax.swing.JFrame; //导入方法依赖的package包/类
/** Start a menu that allows the user to launch a number of demos for the
* JSpikeStack package. To add a new demo to the menu:
* 1) Add the appropriate element to the "Demos" enumerator (above);
* 2) Add the button in demoMenu()
* 3) Connect the enumerator element to the appropriate function in DemoLauncher through the switch statement.
*/
public static void demoMenu()
{
JFrame frm=new JFrame();
frm.setTitle("JSpikeStack demos");
Container pane=frm.getContentPane();
JButton button;
pane.setLayout(new GridBagLayout());
addDemoButton("Network Generation Demo","Read a network From XML and let it generate",Demos.GENERATE,pane);
addDemoButton("Learning Demo","Read an AER file, initialize a random net, and run STDP learning",Demos.LEARN,pane);
addDemoButton("Convolution Demo", "Here we read data from the Silicon retina. Two output layers respond to vertically and horizontally oriented features.",Demos.CONV,pane);
addDemoButton("RC Network", "Takes retina inputs and fires them to a smoothing network.",Demos.RCNET,pane);
addDemoButton("Retina", "In this demo we mimic the behaviour of a variety of types of retinal ganglion cell.",Demos.RETINA,pane);
frm.setPreferredSize(new Dimension(500,500));
frm.pack();
frm.setVisible(true);
frm.toFront();
frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
示例4: setDefaultMenuBar
import javax.swing.JFrame; //导入方法依赖的package包/类
void setDefaultMenuBar(final JMenuBar menuBar) {
installDefaultMenuBar(menuBar);
// scan the current frames, and see if any are foreground
final Frame[] frames = Frame.getFrames();
for (final Frame frame : frames) {
if (frame.isVisible() && !isFrameMinimized(frame)) {
return;
}
}
// if we have no foreground frames, then we have to "kick" the menubar
final JFrame pingFrame = new JFrame();
pingFrame.getRootPane().putClientProperty("Window.alpha", Float.valueOf(0.0f));
pingFrame.setUndecorated(true);
pingFrame.setVisible(true);
pingFrame.toFront();
pingFrame.setVisible(false);
pingFrame.dispose();
}
示例5: topComponentRequestActive
import javax.swing.JFrame; //导入方法依赖的package包/类
protected void topComponentRequestActive(TopComponent tc) {
JFrame f = (JFrame) SwingUtilities.getAncestorOfClass(JFrame.class, tc);
if (f != null) {
f.toFront();
}
registry().setActive(tc);
activateComponent(tc);
}
示例6: show
import javax.swing.JFrame; //导入方法依赖的package包/类
/** Make the frame visible, non-iconized, and focused. */
public static void show(JFrame frame) {
frame.setVisible(true);
frame.setExtendedState(frame.getExtendedState() & ~JFrame.ICONIFIED);
frame.requestFocus();
frame.toFront();
}
示例7: setUp
import javax.swing.JFrame; //导入方法依赖的package包/类
protected void setUp() throws Exception {
// UIManager.setLookAndFeel(new com.sun.java.swing.plaf.windows.WindowsLookAndFeel());
// UIManager.setLookAndFeel(new com.sun.java.swing.plaf.gtk.GTKLookAndFeel());
if (setup) return;
// Create new TesBasicProperty
basicProp= new BasicProperty("basicProp", true);
tags1 = new TagsProperty("tags1", true, new String[] {"What","is","the","meaning","of","life"});
tags2 = new TagsProperty("tags2", true, new String[] {"NetBeans","can be ","really","cool"});
tags3 = new TagsProperty("tags3", true, new String[] {"Behold","the","power","of","cheese"});
booleanProp = new BooleanProperty("booleanProp", true);
customProp = new CustomProperty("CustomProp", true);
customProp2 = new CustomProperty("CustomProp2", true);
ExceptionProperty exProp = new ExceptionProperty("Exception prop", true);
NumProperty numProp = new NumProperty("Int prop", true);
EditableNumProperty edProp = new EditableNumProperty("Editable", true);
// Create new BasicEditor
te = new BasicEditor();
ec = new EditorCustom();
// Create new TNode
tn = new TNode();
jf = new JFrame();
jf.getContentPane().setLayout(new BorderLayout());
jp = new JPanel();
jp.setLayout(new FlowLayout());
jf.getContentPane().add(jp, BorderLayout.CENTER);
jf.setLocation(20,20);
jf.setSize(600, 200);
basicRen = new PropertyPanel(basicProp);
tagsRen1 = new PropertyPanel(tags1);
tagsRen2 = new PropertyPanel(tags2);
tagsRen3 = new PropertyPanel(tags3);
boolRen = new PropertyPanel(booleanProp);
custRen = new PropertyPanel(customProp);
custRen2 = new PropertyPanel(customProp2);
exRen = new PropertyPanel(exProp);
numRen = new PropertyPanel(numProp);
edRen = new PropertyPanel(edProp);
tagsRen2.putClientProperty("radioButtonMax", new Integer(10));
renderers = new PropertyPanel[] {
basicRen, tagsRen1, tagsRen2, boolRen, custRen, edRen, numRen
};
launcher = new JButton("Invoke dialog");
launcher.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
invokeDlg();
}
});
jf.getContentPane().add(launcher);
new WaitWindow(jf); //block until window open
jf.toFront();
ExtTestCase.requestFocus(launcher);
sleep();
Thread.currentThread().sleep(300);
sleep();
currRen = basicRen;
setup = true;
}
示例8: displayCalibrationStatus
import javax.swing.JFrame; //导入方法依赖的package包/类
protected void displayCalibrationStatus(JFrame frame) throws Exception {
double[] pointsNormalized = jniGetCalibration();
if (pointsNormalized == null)
throw new IOException("Can't get calibration data!");
int zeros = 0;
for( double ord: pointsNormalized){
if( ord <= 0 || ord > 1) zeros++;
}
ArrayList<Point2D.Double> points = new ArrayList<Point2D.Double>();
ArrayList<Point2D.Double> invalidpoints = new ArrayList<Point2D.Double>();
//if( zeros > 0 ) throw new IOException("zeros in points: "+zeros+"/"+pointsNormalized.length);
int itemCount = pointsNormalized.length/4;
for( int i=0; i < itemCount; i++ ){
points.add(new Point2D.Double(pointsNormalized[i],pointsNormalized[i+itemCount]));
points.add(new Point2D.Double(pointsNormalized[(2*itemCount)+i],pointsNormalized[i+(itemCount*3)]));
}
Rectangle2D.Double rect = new Rectangle2D.Double(0.0,0.0,1.0,1.0);
for(Point2D.Double p: points){
if( !rect.contains(p) ) invalidpoints.add(p);
}
for (int i = 0; i < pointsNormalized.length; i++) {
if (pointsNormalized[i] < 0.0001) {
pointsNormalized[i] = 0.0001;
} else if (pointsNormalized[i] > 0.9999) {
pointsNormalized[i] = 0.9999;
} else {
//do nothing
}
}
Point2D.Double[] calibrationData = new Point2D.Double[itemCount+1];
for (int j = 0; j < itemCount; j+=2) {
calibrationData[j] = (new Point2D.Double(pointsNormalized[j],pointsNormalized[itemCount+j]));
if(j != itemCount)
calibrationData[j+1] = (new Point2D.Double(pointsNormalized[2*itemCount+j],pointsNormalized[3*itemCount+j]));
}
JFrame calibFrame = frame;
CalibrationStatusDisplay calibDisplay =
new CalibrationStatusDisplay(calibFrame,calibrationPoints,calibrationData);
calibFrame.add(calibDisplay);
calibFrame.setUndecorated(false);
calibFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
calibFrame.setExtendedState(JFrame.MAXIMIZED_BOTH);
calibFrame.setMinimumSize(new Dimension(600,300));
calibFrame.setTitle("Calibration: "+new Date());
Insets insets = calibFrame.getInsets();
int width = calibFrame.getSize().width-(insets.left+insets.right);
int height = calibFrame.getSize().height-(insets.top+insets.bottom);
calibDisplay.windowDimension = new Dimension(width,height);
calibFrame.setVisible(true);
calibFrame.toFront();
calibDisplay.repaint();
}
示例9: createAndShowGUI
import javax.swing.JFrame; //导入方法依赖的package包/类
private static void createAndShowGUI() {
mainFrame = new JFrame("Bug 8033699 - 8 Tests for Grouped/Non Group Radio Buttons");
btnStart = new JButton("Start");
btnEnd = new JButton("End");
btnMiddle = new JButton("Middle");
JPanel box = new JPanel();
box.setLayout(new BoxLayout(box, BoxLayout.Y_AXIS));
box.setBorder(BorderFactory.createTitledBorder("Grouped Radio Buttons"));
radioBtn1 = new JRadioButton("A");
radioBtn2 = new JRadioButton("B");
radioBtn3 = new JRadioButton("C");
ButtonGroup btnGrp = new ButtonGroup();
btnGrp.add(radioBtn1);
btnGrp.add(radioBtn2);
btnGrp.add(radioBtn3);
radioBtn1.setSelected(true);
box.add(radioBtn1);
box.add(radioBtn2);
box.add(btnMiddle);
box.add(radioBtn3);
radioBtnSingle = new JRadioButton("Not Grouped");
radioBtnSingle.setSelected(true);
mainFrame.getContentPane().add(btnStart);
mainFrame.getContentPane().add(box);
mainFrame.getContentPane().add(radioBtnSingle);
mainFrame.getContentPane().add(btnEnd);
mainFrame.getRootPane().setDefaultButton(btnStart);
btnStart.requestFocus();
mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mainFrame.setLayout(new BoxLayout(mainFrame.getContentPane(), BoxLayout.Y_AXIS));
mainFrame.setSize(300, 300);
mainFrame.setLocation(200, 200);
mainFrame.setVisible(true);
mainFrame.toFront();
}
示例10: actionPerformed
import javax.swing.JFrame; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent event) {
JFrame frame = getJFrame();
frame.setExtendedState(Frame.NORMAL);
frame.setVisible(true);
frame.toFront();
}