Problème:BorderLayout problème avec JSplitPane après avoir ajouté JToolBar (Java)
Ma mise en page du programme est très bien, comme ci-dessous avant d'ajouter JToolBar à BorderLayout.PAGE_START
Voici une capture d'écran avant JToolBar est ajouté:
Voilà comment cela ressemblait à l'ajout de JToolbar:
Puis-je savoir ce que j'ai fait de mal?
Voici le code je:
//Create the text pane and configure it.
textPane = new JTextPane();
-snipped code-
JScrollPane scrollPane = new JScrollPane(textPane);
scrollPane.setPreferredSize(new Dimension(300, 300));
//Create the text area for the status log and configure it.
changeLog = new JTextArea(5, 30);
changeLog.setEditable(false);
JScrollPane scrollPaneForLog = new JScrollPane(changeLog);
//Create a split pane for the change log and the text area.
JSplitPane splitPane = new JSplitPane(
JSplitPane.VERTICAL_SPLIT,
scrollPane, scrollPaneForLog);
splitPane.setOneTouchExpandable(true);
//Create the status area.
JPanel statusPane = new JPanel(new GridLayout(1, 1));
CaretListenerLabel caretListenerLabel =
new CaretListenerLabel("Caret Status");
statusPane.add(caretListenerLabel);
//Create the toolbar
JToolBar toolBar = new JToolBar();
-snipped code-
//Add the components.
getContentPane().add(toolBar, BorderLayout.PAGE_START);
getContentPane().add(splitPane, BorderLayout.CENTER);
getContentPane().add(statusPane, BorderLayout.PAGE_END);
//Set up the menu bar.
actions = createActionTable(textPane);
JMenu editMenu = createEditMenu();
JMenu styleMenu = createStyleMenu();
JMenuBar mb = new JMenuBar();
mb.add(editMenu);
mb.add(styleMenu);
setJMenuBar(mb);
S'il vous plaît aider, je suis nouveau bâtiment GUI, et je ne me sens pas comme utiliser Netbeans pour faire glisser et déposer l'interface utilisateur pour moi ... Merci en avance.
@trashgod: Oh! Donc c'est comme ça que ça doit être. Je vous remercie! –