-4
我只是无法得到这个出现我想要的方式,即时用尽试图网格布局,GridBagLayout中,的borderlayout等等的Java Swing网格布局问题
PLZ我需要帮助
这是我做了什么至今
panneauEst = new JPanel(new BorderLayout());
zoneTexte = new JTextArea("LIVRES", 45, 50);
scroller= new JScrollPane(zoneTexte);
scroller.setPreferredSize(new Dimension(600, 580));
scroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
EcouteurBoutons btnEcouteur = new EcouteurBoutons();
btnTrierCote = new JButton("Trier par cote");
btnTrierCote.addActionListener(btnEcouteur);
btnTrierTitre = new JButton("Trier par titre");
btnRechercheCote = new JButton("Rechercher par cote");
btnRechercheTitre = new JButton("Rechercher par titre");
btnFusion = new JButton("Fusion");
btnQuitter = new JButton("Quitter");
panneauEst.add(scroller);
//http://stackoverflow.com/questions/15104630/java-swing-gridlayout-issue
this.setLayout(new GridLayout(6, 2));
this.add(panneauEst);
this.add(btnTrierCote);
this.add(btnTrierTitre);
this.add(btnRechercheCote);
this.add(btnRechercheTitre);
this.add(btnFusion);
this.add(btnQuitter);
这很好。预计如何知道你想要达到的目标是什么? – MadProgrammer 2013-02-27 05:10:16
你有没有想过可能做2个面板而不只是一个?一个带有'GridLayout(1,2)'和另一个可能是'GridLayout(6,1)'的面板?我会让你决定如何处理这些问题。 – pattmorter 2013-02-27 05:18:06
我不认为我可以,我的老师并没有在图中声明2个jpanel:( – 2013-02-27 05:22:04