本文整理匯總了Java中javax.swing.JFrame.setBounds方法的典型用法代碼示例。如果您正苦於以下問題:Java JFrame.setBounds方法的具體用法?Java JFrame.setBounds怎麽用?Java JFrame.setBounds使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JFrame
的用法示例。
在下文中一共展示了JFrame.setBounds方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initialize
import javax.swing.JFrame; //導入方法依賴的package包/類
/**
* Initialize the contents of the frame.
*/
private void initialize() {
textFieldInput.setBounds(169, 15, 245, 26);
textFieldInput.setColumns(10);
frame = new JFrame();
frame.setResizable(false);
frame.setBounds(100, 100, 450, 195);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
lblTapezVotreChaine.setBounds(18, 20, 150, 16);
frame.getContentPane().add(lblTapezVotreChaine);
frame.getContentPane().add(textFieldInput);
btnSeparation.addActionListener(new BtnSeparationActionListener());
btnSeparation.setBounds(116, 68, 210, 29);
frame.getContentPane().add(btnSeparation);
lblOutput.setBounds(18, 131, 396, 16);
frame.getContentPane().add(lblOutput);
}
示例2: initialize
import javax.swing.JFrame; //導入方法依賴的package包/類
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame("Library Book Loan System - My Books and Reservations");
frame.setResizable(false);
frame.setBounds(100, 100, 700, 400);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
JLabel label = new JLabel("Library Book Loan System");
label.setHorizontalAlignment(SwingConstants.CENTER);
label.setFont(new Font("Segoe UI Light", Font.PLAIN, 18));
label.setBounds(10, 11, 674, 30);
frame.getContentPane().add(label);
JLabel lblBookReservations = new JLabel("My Books and Reservations");
lblBookReservations.setHorizontalAlignment(SwingConstants.CENTER);
lblBookReservations.setFont(new Font("Segoe UI Light", Font.PLAIN, 14));
lblBookReservations.setBounds(10, 42, 674, 22);
frame.getContentPane().add(lblBookReservations);
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
tabbedPane.setBackground(SystemColor.text);
tabbedPane.setBounds(10, 75, 674, 228);
frame.getContentPane().add(tabbedPane);
initializeCurrentBooks(tabbedPane);
initializeWaitlist(tabbedPane);
initializeHistory(tabbedPane);
frame.setVisible(true);
}
示例3: initialize
import javax.swing.JFrame; //導入方法依賴的package包/類
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("ProxyHistoryWebUI standalone mode");
frame.setBounds(100, 100, 600, 450);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(new BorderLayout(0, 0));
frame.getContentPane().add(new DemoPanel(appContext), BorderLayout.CENTER);
}
示例4: initialize
import javax.swing.JFrame; //導入方法依賴的package包/類
/**
* Initializes the GUI.
*/
private void initialize(){
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
// error window
windowError = new JFrame();
windowError.setBounds(100, 100, 300, 145);
windowError.setLocation(dim.width/2-windowError.getSize().width/2, dim.height/2-windowError.getSize().height/2);
windowError.setResizable(false);
windowError.setTitle("Ladder Tracker v" + version);
windowError.setIconImage(new ImageIcon(getClass().getResource("icon.png")).getImage());
windowError.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
windowError.getContentPane().setLayout(null);
// button retry
buttonRetry = new JButton("Retry");
buttonRetry.setBounds(10, 80, 274, 23);
buttonRetry.addActionListener(buttonRetryListener);
windowError.getContentPane().add(buttonRetry);
// error text
JTextPane textError = new JTextPane();
textError.setText(errorMessage);
textError.setEditable(false);
textError.setBackground(SystemColor.menu);
textError.setBounds(10, 21, 274, 39);
windowError.getContentPane().add(textError);
}
示例5: initialize
import javax.swing.JFrame; //導入方法依賴的package包/類
/**
* Initialize the contents of the frame.
*/
private void initialize() {
txtRepetitions.setBounds(192, 55, 61, 26);
txtRepetitions.setColumns(10);
txtTexte.setBounds(192, 17, 250, 26);
txtTexte.setColumns(10);
frame = new JFrame();
frame.setResizable(false);
frame.setBounds(100, 100, 485, 452);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
frame.getContentPane().add(txtTexte);
frame.getContentPane().add(txtRepetitions);
lblTexte.setBounds(145, 22, 61, 16);
frame.getContentPane().add(lblTexte);
lblNombreDeRptitions.setBounds(39, 60, 156, 16);
frame.getContentPane().add(lblNombreDeRptitions);
btnRpter.addActionListener(new BtnRpterActionListener());
btnRpter.setBounds(260, 55, 177, 29);
frame.getContentPane().add(btnRpter);
txtrZoneDeTexte.setBounds(37, 103, 406, 291);
frame.getContentPane().add(txtrZoneDeTexte);
}
示例6: createAndShowGUI
import javax.swing.JFrame; //導入方法依賴的package包/類
public void createAndShowGUI() {
frame = new JFrame("TEST");
JMenuBar mb = new JMenuBar();
menu = mb.add(createMenu("1 - First Menu", true));
mb.add(createMenu("2 - Second Menu", false));
frame.setJMenuBar(mb);
JTextArea ta = new JTextArea("This test dedicated to Nancy and Kathleen, testers and bowlers extraordinaire\n\n\nNo exception means pass.");
frame.getContentPane().add("Center", ta);
JButton button = new JButton("Test");
frame.getContentPane().add("South", button);
frame.setBounds(100, 100, 400, 400);
frame.setVisible(true);
button.requestFocusInWindow();
}
示例7: initAndShowGUI
import javax.swing.JFrame; //導入方法依賴的package包/類
private void initAndShowGUI() {
JFrame w = new JFrame();
w.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
if (!QConfig.cfg().isDebug()) {
w.setUndecorated(true);
}
// Create JavaFX panel.
/* todo
javafxPanel = new JFXPanel();
javafxPanel.setPreferredSize(new Dimension(win_w, win_h));
w.getContentPane().add(javafxPanel, BorderLayout.CENTER);
*
*/
initFXscene();
// Show frame.
w.pack();
w.setLocationRelativeTo(null);
w.setVisible(true);
if (QConfig.cfg().isDebug()) {
w.setBounds(100, 100, 1024, 768);
} else {
w.setBounds(win_x, win_y, win_w, win_h);
w.setAlwaysOnTop(true);
}
}
示例8: initialize
import javax.swing.JFrame; //導入方法依賴的package包/類
/**
* Initialize the contents of the frame.
*/
private void initialize() {
txtResultat.setBounds(242, 175, 181, 26);
txtResultat.setColumns(10);
txtEntrePoid.setBounds(242, 27, 181, 26);
txtEntrePoid.setColumns(10);
frame = new JFrame();
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
lblEntrezUnPoids.setBounds(6, 32, 224, 16);
frame.getContentPane().add(lblEntrezUnPoids);
frame.getContentPane().add(txtEntrePoid);
lblChoisirLeType.setBounds(6, 73, 211, 16);
frame.getContentPane().add(lblChoisirLeType);
Choix.setModel(new DefaultComboBoxModel(new String[] {"Faites un choix...", "Kilogramme à Livres", "Kilogramme à Onces"}));
Choix.setSelectedIndex(0);
Choix.setBounds(242, 69, 181, 27);
frame.getContentPane().add(Choix);
btnConvertir.addActionListener(new BtnConvertirActionListener());
btnConvertir.setBounds(47, 122, 117, 29);
frame.getContentPane().add(btnConvertir);
lblPoidsConvertis.setBounds(6, 180, 123, 16);
frame.getContentPane().add(lblPoidsConvertis);
frame.getContentPane().add(txtResultat);
}
示例9: actionPerformed
import javax.swing.JFrame; //導入方法依賴的package包/類
@Override
public void actionPerformed(ActionEvent e) {
JComboBox cb = (JComboBox) e.getSource();
JFrame frame = (JFrame) cb.getParent().getParent().getParent().getParent();
Pair<Procedure, Integer> proc = (Pair<Procedure, Integer>) cb.getSelectedItem();
MarkovGraph g = partitionGraphs.get(proc);
assert (g != null);
GraphVisualizationPanel<MarkovVertex, MarkovEdge> graph_panel = MarkovViewer.getPanel(g);
graph_panel.add(cb);
frame.setContentPane(graph_panel);
frame.setBounds(50, 50, 500, 500);
frame.setVisible(true);
}
示例10: launch
import javax.swing.JFrame; //導入方法依賴的package包/類
public static void launch(
Map<Pair<Procedure, Integer>, MarkovGraph> partitionGraphs,
Pair<Procedure,Integer> selection) {
JFrame frame = new JFrame("Simple Graph View");
JComboBox partcombo = MarkovViewer.makePartitionComboBox(partitionGraphs);
MarkovGraph test_graph = partitionGraphs.get(selection);
frame.setContentPane(MarkovViewer.getPanel(test_graph));
frame.add(partcombo);
partcombo.setSelectedItem(selection);
frame.setBounds(50, 50, 2000, 500);
frame.setVisible(true);
}
示例11: main
import javax.swing.JFrame; //導入方法依賴的package包/類
public static void main(final String[] args) throws Exception {
final JFrame frame = new DrawBitmaskToSurfaceTest();
frame.setBounds(10, 350, 200, 200);
frame.setVisible(true);
Thread.sleep(2000);
System.err.println("Change frame bounds...");
latch = new CountDownLatch(1);
frame.setBounds(10, 350, 90, 90);
frame.repaint();
try {
if (latch.getCount() > 0) {
latch.await();
}
} catch (InterruptedException e) {
}
frame.dispose();
if (theError != null) {
throw new RuntimeException("Test failed.", theError);
}
System.err.println("Test passed");
}
示例12: JProgressDemo
import javax.swing.JFrame; //導入方法依賴的package包/類
public JProgressDemo() {
frame = new JFrame("install");
frame.setLayout(new BorderLayout());
label = new JLabel("progress",SwingConstants.CENTER);
progressbar = new JProgressBar();
progressbar.setOrientation(JProgressBar.HORIZONTAL);
progressbar.setMinimum(0);
progressbar.setMaximum(100);
progressbar.setValue(0);
//progressbar.setStringPainted(true);
progressbar.addChangeListener(this);
progressbar.setPreferredSize(new Dimension(300, 10));
progressbar.setBorderPainted(false);
progressbar.setBackground(Color.pink);
JPanel progressPane = new JPanel();
progressPane.add(progressbar);
progressPane.setPreferredSize(new Dimension(300, 10));
JPanel panel = new JPanel();
b = new JButton("install");
stop = new JButton("pause");
b.setForeground(Color.blue);
b.addActionListener(this);
stop.addActionListener(this);
panel.add(b);
panel.add(stop);
// timer=new Timer(100,this);
timer = new Timer(1000/10, this);
frame.add(panel, BorderLayout.NORTH);
frame.add(progressPane, BorderLayout.CENTER);
frame.add(label, BorderLayout.SOUTH);
// frame.pack();
frame.setBounds(100, 100, 400, 130);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
示例13: initialize
import javax.swing.JFrame; //導入方法依賴的package包/類
private void initialize() {
textLettre.setBounds(143, 389, 38, 26);
textLettre.setColumns(10);
frame = new JFrame();
frame.setResizable(false);
frame.setBounds(100, 100, 450, 510);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
lblLeJeuDu.setFont(new Font("Lucida Grande", Font.PLAIN, 21));
lblLeJeuDu.setBounds(143, 22, 165, 26);
frame.getContentPane().add(lblLeJeuDu);
lblLettresDjEssayes.setBounds(31, 447, 141, 16);
frame.getContentPane().add(lblLettresDjEssayes);
textLettresEssayes.setEditable(false);
textLettresEssayes.setBounds(184, 446, 240, 19);
frame.getContentPane().add(textLettresEssayes);
lblLettreEssayer.setBounds(31, 394, 106, 16);
frame.getContentPane().add(lblLettreEssayer);
frame.getContentPane().add(textLettre);
btnEssayerCeteLettre.addActionListener(new BtnEssayerCeteLettreActionListener());
btnEssayerCeteLettre.setBounds(220, 383, 165, 41);
frame.getContentPane().add(btnEssayerCeteLettre);
lblAprsErreurs.setBounds(31, 350, 381, 16);
frame.getContentPane().add(lblAprsErreurs);
panel.setBackground(Color.WHITE);
panel.setBounds(31, 69, 381, 231);
frame.getContentPane().add(panel);
panel.setLayout(null);
lblNewLabel.setBounds(87, 6, 215, 219);
panel.add(lblNewLabel);
lblMotATrouve.setFont(new Font("Lucida Grande", Font.BOLD, 22));
lblMotATrouve.setBounds(31, 312, 381, 26);
frame.getContentPane().add(lblMotATrouve);
}
示例14: initGui
import javax.swing.JFrame; //導入方法依賴的package包/類
void initGui() {
Font font = new Font("Courier", Font.PLAIN, 14);
command = new JTextField(40);
command.setFont(font);
command.setToolTipText("Type a Jason operation here.");
command.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
execCmd(command.getText().trim());
}
});
//mindPanel = new JTextPane();
//mindPanel.setEditable(false);
//mindPanel.setContentType("text/html");
output = new JTextArea(5,50);
output.setFont(font);
output.setEditable(false);
output.setText("Example of operations you can type:\n +bel; !goal; .add_plan({+!goal <- .print(ok) }); !!goal; \n .send(bob,tell,hello);\n");
output.append(" ?bel(A); .findall(X,bel(X),L); \n");
output.append(" .mi // to open mind inspector\n");
output.append(" .verbose(2) // to show debug messages\n");
output.append(" .clear // clean console\n");
output.append("\nYou can add more agents using the button 'new REPL ag' in MAS Console.");
output.append("\n");
frame = new JFrame(".:: REPL Interface for "+getTS().getUserAgArch().getAgName()+" ::.");
frame.getContentPane().setLayout(new BorderLayout());
frame.getContentPane().add(BorderLayout.NORTH,command);
//f.getContentPane().add(BorderLayout.CENTER, new JScrollPane(mindPanel));
frame.getContentPane().add(BorderLayout.CENTER,new JScrollPane(output));
frame.pack();
int h = 200;
int w = (int)(h*2*1.618);
frame.setBounds((int)(h*0.618), 20, w, h);
frame.setLocation(lastPos, 200+lastPos);
lastPos += 50;
frame.setVisible(true);
}
示例15: initialize
import javax.swing.JFrame; //導入方法依賴的package包/類
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame("Library Book Loan System - Notifications");
frame.setResizable(false);
frame.setBounds(100, 100, 438, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel panel = new JPanel();
frame.getContentPane().add(panel, BorderLayout.CENTER);
panel.setLayout(null);
JLabel lblNotifications = new JLabel("Notifications");
lblNotifications.setHorizontalAlignment(SwingConstants.CENTER);
lblNotifications.setFont(new Font("Segoe UI Light", Font.PLAIN, 14));
lblNotifications.setBounds(10, 40, 414, 22);
panel.add(lblNotifications);
JLabel label_1 = new JLabel("Library Book Loan System");
label_1.setHorizontalAlignment(SwingConstants.CENTER);
label_1.setFont(new Font("Segoe UI Light", Font.PLAIN, 18));
label_1.setBounds(10, 11, 414, 25);
panel.add(label_1);
JPanel panel_1 = new JPanel();
panel_1.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Available Books", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
panel_1.setBounds(10, 73, 414, 177);
panel.add(panel_1);
panel_1.setLayout(null);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(10, 22, 394, 144);
panel_1.add(scrollPane);
Object columnNames[] = { "No", "Message" };
Object rowData[][] = getNotifications();
table = new JTable(rowData, columnNames)
{
@Override
public boolean isCellEditable(int row, int column) {
return false;
}
};
table.setBackground(Color.white);
table.setOpaque(true);
table.getTableHeader().setReorderingAllowed(false);
TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>(table.getModel());
table.setRowSorter(sorter);
List<RowSorter.SortKey> sortKeys = new ArrayList<>(25);
sortKeys.add(new RowSorter.SortKey(0, SortOrder.ASCENDING));
sorter.setSortKeys(sortKeys);
table.getColumnModel().getColumn(0).setMaxWidth(40);
scrollPane.setViewportView(table);
}