本文整理汇总了Java中javax.swing.JFrame.setSize方法的典型用法代码示例。如果您正苦于以下问题:Java JFrame.setSize方法的具体用法?Java JFrame.setSize怎么用?Java JFrame.setSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JFrame
的用法示例。
在下文中一共展示了JFrame.setSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import javax.swing.JFrame; //导入方法依赖的package包/类
/**
* Simple test case for the gradient painter
*
* @param argv The arguments supplied at the command line
*/
public static void main(String[] argv) {
JFrame frame = new JFrame();
JPanel panel = new JPanel();
panel.setBorder(BorderFactory.createTitledBorder("Gradient"));
panel.setLayout(null);
frame.setContentPane(panel);
GradientEditor editor = new GradientEditor();
editor.setBounds(10,15,270,100);
panel.add(editor);
frame.setSize(300,200);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
frame.setVisible(true);
}
示例2: setUp
import javax.swing.JFrame; //导入方法依赖的package包/类
protected void setUp() throws Exception {
if (setup) return;
PropUtils.forceRadioButtons=false;
try {
tp = new TProperty("oh", true);
tp1 = new TProperty2("the", true);
tp2 = new TProperty2("pretty", true);
tp3 = new TProperty2("pictures",true);
tp4 = new TProperty3("I can create",true);
postSetAction = new PostSetAction();
tn = new TNode();
final PropertySheet ps = new PropertySheet();
//ensure no stored value in preferences:
ps.setCurrentNode(tn);
sleep();
ps.setSortingMode(PropertySheet.UNSORTED);
jf = new JFrame();
jf.getContentPane().add(ps);
jf.setLocation(20,20);
jf.setSize(300, 400);
new WaitWindow(jf);
tb = ps.table;
ps.setSortingMode(ps.SORTED_BY_NAMES);
jf.repaint();
} catch (Exception e) {
e.printStackTrace();
fail("FAILED - Exception thrown "+e.getClass().toString());
} finally {
setup = true;
}
}
示例3: testDefaultFont
import javax.swing.JFrame; //导入方法依赖的package包/类
private static void testDefaultFont(final JFrame frame) {
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JSpinner spinner = new JSpinner();
frame.add(spinner);
frame.setSize(300, 100);
frame.setVisible(true);
final DefaultEditor editor = (DefaultEditor) spinner.getEditor();
final Font editorFont = editor.getTextField().getFont();
/*
* Validate that the font of the text field is changed to the
* font of JSpinner if the font of text field was not set by the
* user.
*/
if (!(editorFont instanceof UIResource)) {
throw new RuntimeException("Font must be UIResource");
}
if (!editorFont.equals(spinner.getFont())) {
throw new RuntimeException("Wrong FONT");
}
}
示例4: startVisualization
import javax.swing.JFrame; //导入方法依赖的package包/类
@Override
public void startVisualization(Object id) {
int index = 0;
if (id instanceof String) {
String idString = (String) id;
index = Integer.parseInt(idString.substring(0, idString.indexOf("(")).trim());
} else {
index = ((Double) id).intValue();
}
AggregationIndividual individual = lastPopulation.get(index);
ExampleSet es = null;
try {
es = individual.createExampleSet(originalExampleSet, allAttributes, generator);
} catch (GenerationException e) {
throw new RuntimeException("Cannot visualize individual '" + index + "': " + e.getMessage());
}
Component visualizationComponent = ResultDisplayTools.createVisualizationComponent(es, null, es.getName());
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
frame.getContentPane().setLayout(new BorderLayout());
frame.getContentPane().add(new ExtendedJScrollPane(visualizationComponent), BorderLayout.CENTER);
frame.setSize(600, 400);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
示例5: popUpInput
import javax.swing.JFrame; //导入方法依赖的package包/类
void popUpInput() {
popUpSearch = new JFrame("Search for Entry");
dateToSearchFor = new JTextField();
search = new JButton("Search");
southPanel = new JPanel();
JLabel label = new JLabel("Entry date to search for");
closeWindow = new JButton("Close");
search.addActionListener(new GetSearchParameter());
closeWindow.addActionListener(new CloseTheWindow());
popUpSearch.getContentPane().add(BorderLayout.NORTH, label);
popUpSearch.getContentPane().add(BorderLayout.CENTER, dateToSearchFor);
popUpSearch.getContentPane().add(BorderLayout.SOUTH, southPanel);
southPanel.add(search);
southPanel.add(closeWindow);
popUpSearch.setSize(300, 110);
popUpSearch.setVisible(true);
popUpSearch.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
示例6: 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);
}
示例7: BhattiproluPad
import javax.swing.JFrame; //导入方法依赖的package包/类
public BhattiproluPad() {
mainFrame = new JFrame("Bhattiprolu Pad - Now, type in Telugu easily");
mainFrame.setSize(800, 800);
mainFrame.setLayout(new GridLayout(3, 1));
headLabel = new JLabel("Bhattiprolu Pad 0.1", JLabel.CENTER);
contentLabel = new JLabel("Empty", JLabel.CENTER);
mainPanel = new JPanel();
mainPanel.setLayout(new FlowLayout());
headLabel.setFont(englishFont);
contentLabel.setFont(teluguFont);
mainFrame.add(headLabel);
mainFrame.add(mainPanel);
mainFrame.add(contentLabel);
mainFrame.setVisible(true);
mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
示例8: detachDisplay
import javax.swing.JFrame; //导入方法依赖的package包/类
protected synchronized void detachDisplay() {
if (currentDB == null) return;
if (currentDB.getDataDisplay() == null) return;
if (currentDB.getDataDisplay().getPreferredSize().height < 50) return;
JFrame displayDialog = getDataDisplayDialog();
displayDialog.setTitle( currentDB.getDBName() );
displayDialog.getContentPane().removeAll();
displayDialog.getContentPane().add(currentDB.getDataDisplay());
int w = vPane.getSize().width;
int h = currentDB.getDataDisplay().getPreferredSize().height;
if(h>200) h=200;
int x = frame.getLocationOnScreen().x;
int y = frame.getLocationOnScreen().y + frame.getHeight();
displayDialog.setSize(w, h);
displayDialog.setLocation(x, y);
vPane.setBottomComponent( null );
displayDialog.setState( Frame.NORMAL );
displayDialog.setVisible(true);
detach_attachB.setText("Attach Profile/Table");
attached = false;
}
示例9: main
import javax.swing.JFrame; //导入方法依赖的package包/类
public static void main(String[] args)
{
// create frame for Shapes2JPanel
JFrame frame = new JFrame("Drawing 2D Shapes");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Shapes2JPanel shapes2JPanel = new Shapes2JPanel();
frame.add(shapes2JPanel);
frame.setBackground(Color.WHITE);
frame.setSize(315, 330);
frame.setVisible(true);
}
示例10: main
import javax.swing.JFrame; //导入方法依赖的package包/类
public static void main(String argv[]) {
ClusteringDemo demo = new SpectralClusteringDemo();
JFrame f = new JFrame("Spectral Clustering");
f.setSize(new Dimension(1000, 1000));
f.setLocationRelativeTo(null);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.getContentPane().add(demo);
f.setVisible(true);
}
示例11: main
import javax.swing.JFrame; //导入方法依赖的package包/类
public static void main(String argv[]) {
ClusteringDemo demo = new SOMDemo();
JFrame f = new JFrame("SOM");
f.setSize(new Dimension(1000, 1000));
f.setLocationRelativeTo(null);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.getContentPane().add(demo);
f.setVisible(true);
}
示例12: createAndShowGUI
import javax.swing.JFrame; //导入方法依赖的package包/类
private static void createAndShowGUI() {
demoFrame = new JFrame();
demoFrame.setSize(300, 300);
demoFrame.setLayout(new FlowLayout());
demoFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
demoFrame.setUndecorated(true);
demoFrame.setBackground(new Color(0f, 0, 0, 0.1f));
JCheckBox b = new JCheckBox("Whatever");
demoFrame.paintAll(null);
b.setOpaque(true);
demoFrame.add(b);
demoFrame.add(new JButton());
demoFrame.setVisible(true);
}
示例13: main
import javax.swing.JFrame; //导入方法依赖的package包/类
public static void main(String[] args)
{
// Create a label with plain text
JLabel northLabel = new JLabel("North");
// create an icon from an image so we can put it on a JLabel
ImageIcon labelIcon = new ImageIcon("GUItip.gif");
// create a label with an Icon instead of text
JLabel centerLabel = new JLabel(labelIcon);
// create another label with an Icon
JLabel southLabel = new JLabel(labelIcon);
// set the label to display text (as well as an icon)
southLabel.setText("South");
// create a frame to hold the labels
JFrame application = new JFrame();
application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// add the labels to the frame; the second argument specifies
// where on the frame to add the label
application.add(northLabel, BorderLayout.NORTH);
application.add(centerLabel, BorderLayout.CENTER);
application.add(southLabel, BorderLayout.SOUTH);
application.setSize(300, 300); // set the size of the frame
application.setVisible(true); // show the frame
}
示例14: LogWindow
import javax.swing.JFrame; //导入方法依赖的package包/类
public LogWindow() {
frame = new JFrame();
frame.setTitle("Latest Log");
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.setSize(600, 480);
frame.setLocationRelativeTo(null);
frame.setResizable(false);
frame.setLayout(null);
panel = new JPanel();
frame.add(panel);
init();
}
示例15: AboutWindow
import javax.swing.JFrame; //导入方法依赖的package包/类
public AboutWindow() {
frame = new JFrame();
frame.setTitle("About");
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.setSize(325, 280);
frame.setLocationRelativeTo(null);
frame.setResizable(false);
frame.setLayout(null);
panel = new JPanel();
frame.add(panel);
initialize();
frame.setVisible(true);
}