Samples - A little help resolved to put radio buttons on an interface, but has enough messy little too much about things - someone who can be transparent what I have done wrong .... (so many things for sure) - but try to focus on Radio Button problem.
Any help would be welcome,
Code:Mvh Einar import javax.swing .*; import java.awt .*; / ** * Description of class Input Interface here. * This is a GUI interface for inputting membership information * @ Author (Einar Petersen) * @ Beta version (v.1.0a6) * / / / In order to create screens, we got to extende with Swing / / change comments to UK Notation - according to class diagram. public class Input Interface extends javax.swing.JFrame ( / / Action List energy must be implemented + plus the establishment of a method - like empty in the first place / / change comments to UK Notation - according to class diagram. / / We appreciate the layout manager / / change comments to UK Notation - according to class diagram. / / erklera jpanels to tveita everything Ã* / / change comments to UK Notation - according to class diagram. private JPanel felt1, felt2, felt3, felt4, felt5, felt6, felt7, felt8, felt9, felt10, felt11; / / so we created some objects containing text boxes and puts the size of these fields / / change comments to UK Notation - according to class diagram. JTextField medlnr = new JTextField (4); JTextField name = new JTextField (30); JTextField street = new JTextField (30); JTextField zip = new JTextField (4); JTextField city = new JTextField (20); JTextField phone = new JTextField (8); JTextField mobile = new JTextField (8); JTextField email = new JTextField (30); JTextField came = new JTextField (30); JTextField COM2 = new JTextField (30); JTextField kom3 = new JTextField (30); JTextField kom4 = new JTextField (30); / / birthday (dd.mm.yyyy - stored outside.) / / indmeldeses date int / / Radio button Elite and Radio Motionist are declared JRadioButton [] memberstatusEliteExercise = new JRadioButton [2]; / / Save Jbutton, erase, retrieve, exit / / / / Here we set the window name and set the close-down condition public Input Interface () ( super ( "Member Information"); setSize (500,400); setDefaultCloseOperation (EXIT_ON_CLOSE); / / setVisible (true); Could in theory be seen here but since it has been placed in the bottom the code should be more robust / / here we put some of menesker readable labels which we then use to "name" objects with " / / change comments to UK Notation - according to class diagram. JLabel medlnrLabel = new JLabel ( "Medl. No"); / / change to the UK Notation - according to class diagram. JLabel name Label = new JLabel ( "Name"); / / change to the UK Notation - according to class diagram. JLabel street Label = new JLabel ( "Street"); / / change to the UK Notation - according to class diagram. JLabel zip = new Label JLabel ( "Zip code."); / / change to the UK Notation - according to class diagram. JLabel byLabel = new JLabel ( "City"); / / change to the UK Notation - according to class diagram. JLabel telephone Label = new JLabel ( "Phone"); / / change to the UK Notation - according to class diagram. JLabel mobile Label = new JLabel ( "Mobile"); / / change to the UK Notation - according to class diagram. JLabel email Label = new JLabel ( "E-Mail:"); / / change to the UK Notation - according to class diagram. JLabel komLabel = new JLabel ( "Comments"); / / change to the UK Notation - according to class diagram. JLabel kom2Label = new JLabel ( ""); / / change to the UK Notation - according to class diagram. JLabel kom3Label = new JLabel ( ""); / / change to the UK Notation - according to class diagram. JLabel kom4Label = new JLabel ( ""); / / change to the UK Notation - according to class diagram. / / There is inserted spaces to adapt the graphic layout / / - This is only done by distress because I am not familiar enough with gridbag / / layout manager who would have been able to handle my requirements for a beautiful layout in the right way! / / change comments to UK Notation - according to class diagram. / / then we create the main window / container / / change comments to UK Notation - according to class diagram. JPanel pane = new JPanel (); pane.setLayout (new Flow Layout (FlowLayout.LEFT)); / / So we Labels and objects up in the individual panels / / change comments to UK Notation - according to class diagram. JPanel felt1 = new JPanel (); / / We do this to us throwing objects medlnrLabel and medlnr down in a container (a JPanel v. name felt1 as declared at the top) / / but first we make a flow layout manager for felt1 container / / change comments to UK Notation - according to class diagram. / / felt1.setLayout (new Grid Layout (1.2)); felt1.add (medlnrLabel); felt1.add (medlnr); pane.add (felt1); / / here we felt1 adder to the main container pane / / We throw objects Label name and the names down in a container (a JPanel v. name felt2 as declared at the top) JPanel felt2 = new JPanel (); / / felt2.setLayout (new Grid Layout (1.2)); felt2.add (Label name); felt2.add (name); pane.add (felt2); / / here we felt2 adder to the main container pane / / We throw objects street name and street address label into a container (a JPanel v. name felt3 as declared at the top) JPanel felt3 = new JPanel (); felt3.add (street name Label); felt3.add (street); pane.add (felt3); / / here we felt3 adder to the main container pane / / We throw objects zip code Label, zip code, byLabel and the city, into a container (a JPanel v. name felt4 as declared at the top) JPanel felt4 = new JPanel (); felt4.add (Zip Code Label); felt4.add (zip); felt4.add (byLabel); felt4.add (city); pane.add (felt4); / / here we felt4 adder to the main container pane / / We throw objects Label phone, mobile phone and Label Mobile, down in a container (a JPanel v. name felt5 as declared at the top) JPanel felt5 = new JPanel (); felt5.add (telephone Label); felt5.add (phone); felt5.add (mobile Label); felt5.add (mobile); pane.add (felt5); / / here we felt5 adder to the main container pane / / We throw objects Label email and email into a container (a JPanel v. name felt6 as we have declared at the top) JPanel felt6 = new JPanel (); felt6.add (email Label); felt6.add (email); pane.add (felt6); / / here we felt6 adder to the main container pane / / We throw objects komLabel and came down in a container (a JPanel v. name feltX as we have declared at the top) JPanel felt7 = new JPanel (); felt7.add (komLabel); felt7.add (came); pane.add (felt7); / / here we felt7 adder to the main container pane / / We throw objects kom2Label and COM2 down in a container (a JPanel v. name felt8 as we have declared at the top) JPanel felt8 = new JPanel (); felt8.add (kom2Label); felt8.add (COM2); pane.add (felt8); / / here we felt8 adder to the main container pane / / We throw objects kom3Label and kom3 down in a container (a JPanel v. name feltX as we have declared at the top) JPanel felt9 = new JPanel (); felt9.add (kom3Label); felt9.add (kom3); pane.add (felt9); / / here we felt9 adder to the main container pane / / We throw objects komXXLabel and komXX down in a container (a JPanel v. name feltX as we have declared at the top) JPanel felt10 = new JPanel (); felt10.add (kom4Label); felt10.add (kom4); pane.add (felt10); / / here we felt10 adder to the main container pane memberstatusEliteExercise [0] = new JRadioButton ( "Motionist"); memberstatusEliteExercise [1] = new JRadioButton ( "Elite"); Button Group radiogroup1 = new Button Group (); for (int i = 0; in <memberstatusEliteExercise.length; i + +); radiogroup1.add (memberstatusEliteExercise [i]); radiogroup1.add (felt13); pane.add (felt13); setContentPane (pane); ) / / Then we create a main callers above party program public static void main (String [] arguments) ( Input Interface input = new Input Interface (); / / Here we Interface (ie the object, we have created) input.setVisible (true); ) )


Java - brain block
) - but try to focus on Radio Button problem.
Reply With Quote

Bookmarks