hi, bin neu in java habe sonst nur c# gemacht
und komme gerade mit flowlayout nicht zurecht..weiß weder wo noch wie ich es einbinden kann..
wollte ein kleines swing machen mit nem ok button und ner combobox..
vllt könnt ihr mir helfen auf den richtigen pfad zu kommen
wo wie und so?
und komme gerade mit flowlayout nicht zurecht..weiß weder wo noch wie ich es einbinden kann..
wollte ein kleines swing machen mit nem ok button und ner combobox..
vllt könnt ihr mir helfen auf den richtigen pfad zu kommen
Java:
Runnable guiCreator = new Runnable() {
public void run() {
//window properties
JFrame window = new JFrame( "J1" ); //initial a window
window.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); //windows shutdown order
//window.setLayout(new FlowLayout());
window.setSize(320,240); //windows size in pixel
window.setVisible(true); //windows visibility
window.setLocation(500, 300); //location of window (desktop coordinates)
//window.setResizable( false ); //windows size not changeable
//window.add( new JLabel( String.format( "%tT",new Date() ) ) );
JLabel labTitle = new JLabel( " J1 Übungsprogramm " );
window.add(labTitle); //add label "ueberschrift"
JComboBox<String> choice = new JComboBox<String>();
choice.setSize(40,20);
//read from database later
choice.addItem("Q1");
choice.addItem("Q2");
choice.addItem("Q3");
choice.addItem("Q4");
window.add(choice);
JButton button1 = new JButton("OK");
window.add(button1);
button1.setSize(30,20);
button1.setLocation(100, 100);
//c#~
//OnClick_Event(button1){
//}
//window.pack(); //format window size
}
};
SwingUtilities.invokeLater(guiCreator);
wo wie und so?