Hallo Leute,
Ich habe ein ARGHES Problem mit diesen Layouts von Java, hoffe ihr könnt mir helfen.
Ich möchte und finde ich habe es so implementiert, Wird allerdings aber NICHT so angezeigt wie ich das mir überlegt habe.
Es sollen 3 Panels sein. Der eine davon ist der Oben, der Oben sollte nochmals 3 Panels haben, das Erste dieser drei Panels (Um es Kurz zu sagen, von den 6 bisher erstellten, das ganz oben links) wird nun mit einem GridLayout(9,2) geteilt. Es soll dann so aussehen:
Links:
Calltype:
National
Call MO
Call MT
SMS MO
....
Rechts
Empty (Abstandhalter)
International
Call MO
Call MT
SMS MO
...
Es wird allerdings mit meinem Code so dargestellt:
Calltype: Empty National
International Call MO Call MO
Call MT Call MT SMS MO
....
Ich bin euch wirklich dankbar für eure Hilfe!
Ich finde es einfach nicht raus und möchte nicht noch mehr Zeit unnötig dabei verbrauchen!
Danke und Gruss
vom LoL
Ich habe ein ARGHES Problem mit diesen Layouts von Java, hoffe ihr könnt mir helfen.
Ich möchte und finde ich habe es so implementiert, Wird allerdings aber NICHT so angezeigt wie ich das mir überlegt habe.
Es sollen 3 Panels sein. Der eine davon ist der Oben, der Oben sollte nochmals 3 Panels haben, das Erste dieser drei Panels (Um es Kurz zu sagen, von den 6 bisher erstellten, das ganz oben links) wird nun mit einem GridLayout(9,2) geteilt. Es soll dann so aussehen:
Links:
Calltype:
National
Call MO
Call MT
SMS MO
....
Rechts
Empty (Abstandhalter)
International
Call MO
Call MT
SMS MO
...
Es wird allerdings mit meinem Code so dargestellt:
Calltype: Empty National
International Call MO Call MO
Call MT Call MT SMS MO
....
Code:
//JPanel
JPanel myPanel = new JPanel();
myPanel.setLayout(new GridLayout(3,1));
myPanel.setLocation(0, 0);
myPanel.setSize(800,600);
JPanel myPanelTop = new JPanel();
myPanelTop.setLayout(new GridLayout(1,3));
myPanelTop.setLocation(0, 0);
myPanelTop.setSize(800, 200);
JPanel myPanelTopLeft = new JPanel();
myPanelTopLeft.setLayout(new GridLayout(9,2));
myPanelTopLeft.setLocation(0, 0);
myPanelTopLeft.setSize(200, 200);
JPanel myPanelTopCenter = new JPanel();
myPanelTopCenter.setLayout(new FlowLayout(FlowLayout.LEFT));
myPanelTopCenter.setLocation(200,0);
myPanelTopCenter.setSize(200, 200);
JPanel myPanelTopRight = new JPanel();
myPanelTopRight.setLayout(new FlowLayout(FlowLayout.LEFT));
myPanelTopRight.setLocation(400, 0);
myPanelTopRight.setSize(300, 200);
JPanel myPanelCenter = new JPanel();
myPanelCenter.setLayout(new FlowLayout(FlowLayout.LEFT));
myPanelCenter.setLocation(0, 200);
myPanelCenter.setSize(800, 200);
JPanel myPanelBottom = new JPanel();
myPanelBottom.setLayout(new FlowLayout(FlowLayout.LEFT));
myPanelBottom.setLocation(0, 400);
myPanelBottom.setSize(800, 200);
//JLabel
JLabel lblEmpty = new JLabel("");
JLabel lblCalltype = new JLabel("Calltype:");
JLabel lblNational = new JLabel("National");
JLabel lblInternational = new JLabel("International");
//JRadioButton
JRadioButton rdbNatCallMO = new JRadioButton("Call MO");
JRadioButton rdbNatCallMT = new JRadioButton("Call MT");
JRadioButton rdbNatSMSMO = new JRadioButton("SMS MO");
JRadioButton rdbNatSMSMT = new JRadioButton("SMS MT");
JRadioButton rdbNatMMSMO = new JRadioButton("MMS MO");
JRadioButton rdbNatMMSMT = new JRadioButton("MMS MT");
JRadioButton rdbNatGPRSMO = new JRadioButton("GPRS MO");
JRadioButton rdbNatGPRSMT = new JRadioButton("GPRS MT");
JRadioButton rdbIntCallMO = new JRadioButton("Call MO");
JRadioButton rdbIntCallMT = new JRadioButton("Call MT");
JRadioButton rdbIntSMSMO = new JRadioButton("SMS MO");
JRadioButton rdbIntSMSMT = new JRadioButton("SMS MT");
JRadioButton rdbIntMMSMO = new JRadioButton("MMS MO");
JRadioButton rdbIntMMSMT = new JRadioButton("MMS MT");
JRadioButton rdbIntGPRSMO = new JRadioButton("GPRS MO");
JRadioButton rdbIntGPRSMT = new JRadioButton("GPRS MT");
//JButton
JButton myRateButton = new JButton("Rate it!");
myRateButton.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent event) {
onClickmyRateButton();
}
}
);
//ButtonGroup
ButtonGroup grpNat = new ButtonGroup();
grpNat.add(rdbNatCallMO);
grpNat.add(rdbNatCallMT);
grpNat.add(rdbNatSMSMO);
grpNat.add(rdbNatSMSMT);
grpNat.add(rdbNatMMSMO);
grpNat.add(rdbNatMMSMT);
grpNat.add(rdbNatGPRSMO);
grpNat.add(rdbNatGPRSMT);
ButtonGroup grpInt = new ButtonGroup();
grpInt.add(rdbIntCallMO);
grpInt.add(rdbIntCallMT);
grpInt.add(rdbIntSMSMO);
grpInt.add(rdbIntSMSMT);
grpInt.add(rdbIntMMSMO);
grpInt.add(rdbIntMMSMT);
grpInt.add(rdbIntGPRSMO);
grpInt.add(rdbIntGPRSMT);
//Assembly GUI components
//myPanelTopLeft.add(myButton, FlowLayout.LEFT);
myPanelTopLeft.add(lblCalltype);
myPanelTopLeft.add(lblEmpty);
myPanelTopLeft.add(lblNational);
myPanelTopLeft.add(lblInternational);
myPanelTopLeft.add(rdbNatCallMO);
myPanelTopLeft.add(rdbIntCallMO);
myPanelTopLeft.add(rdbNatCallMT);
myPanelTopLeft.add(rdbIntCallMT);
myPanelTopLeft.add(rdbNatSMSMO);
myPanelTopLeft.add(rdbIntSMSMO);
myPanelTopLeft.add(rdbNatSMSMT);
myPanelTopLeft.add(rdbIntSMSMT);
myPanelTopLeft.add(rdbNatMMSMO);
myPanelTopLeft.add(rdbIntMMSMO);
myPanelTopLeft.add(rdbNatMMSMT);
myPanelTopLeft.add(rdbIntMMSMT);
myPanelTopLeft.add(rdbNatGPRSMO);
myPanelTopLeft.add(rdbIntGPRSMO);
myPanelTopLeft.add(rdbNatGPRSMT);
myPanelTopLeft.add(rdbIntGPRSMT);
myPanelTopCenter.add(new JLabel("myPanelTopCenter"));
myPanelTopRight.add(new JLabel("myPanelTopRight"));
myPanelTop.add(myPanelTopLeft);
myPanelTop.add(myPanelTopCenter);
myPanelTop.add(myPanelTopRight);
myPanelCenter.add(new JLabel("myPanelCenter"));
myPanelBottom.add(new JLabel("myPanelBottom"));
myPanel.add(myPanelTop);
myPanel.add(myPanelCenter);
myPanel.add(myPanelBottom);
//Assembly GUI components into JFrame
this.setJMenuBar(myMenuBar);
this.getContentPane().add(myPanel);
this.pack();
Ich bin euch wirklich dankbar für eure Hilfe!
Ich finde es einfach nicht raus und möchte nicht noch mehr Zeit unnötig dabei verbrauchen!
Danke und Gruss
vom LoL