本文整理汇总了Java中javax.swing.JFrame.setLocationRelativeTo方法的典型用法代码示例。如果您正苦于以下问题:Java JFrame.setLocationRelativeTo方法的具体用法?Java JFrame.setLocationRelativeTo怎么用?Java JFrame.setLocationRelativeTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JFrame
的用法示例。
在下文中一共展示了JFrame.setLocationRelativeTo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawAndSave
import javax.swing.JFrame; //导入方法依赖的package包/类
public static void drawAndSave(JPanel graphDrawing, String fileName) {
JFrame frame = new JFrame("Drawing");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(graphDrawing);
frame.setSize(500, 500);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
exportToImage("jpg", graphDrawing, fileName);
frame.dispose();
}
示例2: main
import javax.swing.JFrame; //导入方法依赖的package包/类
public static void main(String[] args) {
JFrame frame = new JFrame("Displacement plot");
frame.setSize(new Dimension(800, 300));
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocationRelativeTo(null);
frame.getContentPane().add(new RegularBinningTest());
frame.setVisible(true);
}
示例3: showtext
import javax.swing.JFrame; //导入方法依赖的package包/类
/** Display a simple non-modal window showing some text. */
public static JFrame showtext(String title, String text) {
JFrame window = new JFrame(title);
JButton done = new JButton("Close");
done.addActionListener(Runner.createDispose(window));
JScrollPane scrollPane = OurUtil.scrollpane(OurUtil.textarea(text, 20, 60, false, false));
window.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
window.getContentPane().setLayout(new BorderLayout());
window.getContentPane().add(scrollPane, BorderLayout.CENTER);
window.getContentPane().add(done, BorderLayout.SOUTH);
window.pack();
window.setSize(500, 500);
window.setLocationRelativeTo(null);
window.setVisible(true);
return window;
}
示例4: createAndShowGUI
import javax.swing.JFrame; //导入方法依赖的package包/类
private static void createAndShowGUI() {
JFrame frame = new JFrame("Extended Speech Services Example");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(new ExtendedExample());
frame.pack();
frame.setVisible(true);
frame.setLocationRelativeTo(null);
}
示例5: createFrame
import javax.swing.JFrame; //导入方法依赖的package包/类
private JFrame createFrame() {
JFrame frame = new JFrame(getClass().getName());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(new Dimension(600, 400));
frame.setLocationRelativeTo(null);
return frame;
}
示例6: main
import javax.swing.JFrame; //导入方法依赖的package包/类
public static void main(String[] args) {
JFrame frame = new JFrame("Poisson Distribution");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocationRelativeTo(null);
frame.getContentPane().add(new PoissonDistributionDemo());
frame.setVisible(true);
}
示例7: main
import javax.swing.JFrame; //导入方法依赖的package包/类
public static void main(String[] args) {
JFrame frame = new JFrame("D4 Wavelet");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocationRelativeTo(null);
frame.add(new D4WaveletDemo());
frame.setVisible(true);
}
示例8: ExtractWindow
import javax.swing.JFrame; //导入方法依赖的package包/类
public ExtractWindow(String zipName, Logger log) {
this.zipName = zipName;
this.log = log;
frame = new JFrame();
frame.setTitle("Extracting Files");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(300, 80);
frame.setLocationRelativeTo(null);
frame.setResizable(false);
frame.setLayout(null);
panel = new JPanel();
frame.add(panel);
init();
}
示例9: constructTestUI
import javax.swing.JFrame; //导入方法依赖的package包/类
private static void constructTestUI() {
testFrame = new JFrame();
testFrame.setSize(600, 600);
testFrame.setResizable(false);
testFrame.getContentPane().add(new TransparentVImage());
testFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
testFrame.setLocationRelativeTo(null);
testFrame.setVisible(true);
}
示例10: main
import javax.swing.JFrame; //导入方法依赖的package包/类
public static void main(String[] args) {
try {
RESParser parser = new RESParser();
AttributeDataset data = parser.parse("RES", smile.data.parser.IOUtils.getTestDataFile("microarray/all_aml_test.res"));
double[][] x = data.toArray(new double[data.size()][]);
String[] genes = data.toArray(new String[data.size()]);
String[] arrays = new String[data.attributes().length];
for (int i = 0; i < arrays.length; i++) {
arrays[i] = data.attributes()[i].getName();
}
JFrame frame = new JFrame("Heatmap");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocationRelativeTo(null);
frame.getContentPane().add(Heatmap.plot(genes, arrays, x, Palette.jet(256)));
frame.setVisible(true);
} catch (Exception ex) {
System.err.println(ex);
}
}
示例11: main
import javax.swing.JFrame; //导入方法依赖的package包/类
public static void main(String[] args) {
JFrame frame = new JFrame("Bernoulli Distribution");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocationRelativeTo(null);
frame.getContentPane().add(new BernoulliDistributionDemo());
frame.setVisible(true);
}
示例12: main
import javax.swing.JFrame; //导入方法依赖的package包/类
public static void main(String[] args)
{
// System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
// logger.info(Core.VERSION);
final ArrayList<File> animalFiles = new ArrayList<File>();
final JFrame frame = new JFrame();
frame.setSize(200, 100);
frame.setLayout(new BoxLayout(frame.getContentPane(), BoxLayout.Y_AXIS));
final JButton createModelButton = new JButton("create model");
JButton compareButton = new JButton("compare");
createModelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dir = FileUtils.selectDirectory(frame, "select folder with (old) .zoo-files to create model");
ArrayList<File> animalFile = new ArrayList<File>();
FileUtils.getImages(dir, animalFile, true);
createModelButton.setText("CREATING!");
try {
generateCodeBook(animalFile, new File(osBaseDir + "_.json"));
} catch (IOException e1) {
e1.printStackTrace();
}
createModelButton.setText("DONE!");
createModelButton.setEnabled(false);
}
});
frame.add(createModelButton);
// frame.add(compareButton);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
示例13: initLayerManager
import javax.swing.JFrame; //导入方法依赖的package包/类
protected void initLayerManager() {
JFrame d = new JFrame();
d.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
((JCheckBoxMenuItem)(XML_Menu.commandToMenuItemHash.get("layer_manager_cmd"))).setSelected(false);
}
});
LayerManager lm;
//use existing layer manager if it already exists
if (layerManager != null) {
lm = layerManager;
} else {
lm = new LayerManager();
}
lm.setLayerList( toLayerList(map.overlays) );
lm.setMap(map);
lm.setDialog(d);
JScrollPane sp = new JScrollPane(lm);
sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
d.setTitle("Layer Manager");
d.setContentPane(sp);
// d.getContentPane().add(sp);
d.pack();
d.setSize(new Dimension(lm.getPreferredSize().width+20,lm.getPreferredSize().height+55));
d.setMaximumSize(new Dimension(400,300));
d.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
d.setLocationRelativeTo(frame);
d.setState(Frame.NORMAL);
d.setAlwaysOnTop(true);
this.layerManager = lm;
this.layerManagerDialog = d;
}
示例14: createUI
import javax.swing.JFrame; //导入方法依赖的package包/类
private static void createUI() {
frame = new JFrame();
frame.setUndecorated(true);
frame.setSize(300, 300);
frame.setLocationRelativeTo(null);
final JDesktopPane pane = new JDesktopPane();
final JPanel panel = new JPanel() {
@Override
protected void paintComponent(Graphics g) {
g.setColor(color);
g.fillRect(0, 0, getWidth(), getHeight());
}
};
jif = new JInternalFrame();
jif.add(panel);
jif.setVisible(true);
jif.setSize(300, 300);
pane.add(jif);
frame.add(pane);
frame.setVisible(true);
}
示例15: InstallBuilderWindow
import javax.swing.JFrame; //导入方法依赖的package包/类
/** Makes The Window */
public InstallBuilderWindow(final String title, final Logger log) {
this.log = log;
frame = new JFrame();
frame.setTitle(title);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(WIDTH, HEIGHT);
frame.setLocationRelativeTo(null);
frame.setLayout(null);
frame.setResizable(false);
panel = new JPanel();
frame.add(panel);
log.Info("Initializing Components...");
initialize();
log.Info("Initialized components successfully!");
}