From dc5fd38510f0ee033c16bf0312ffad6fa0fc1959 Mon Sep 17 00:00:00 2001 From: Derek Provance Date: Tue, 10 May 2016 10:34:43 -0500 Subject: [PATCH] resized combobox --- freemind/controller/Controller.java | 65 ++++++++++--------- .../modes/mindmapmode/MindMapToolBar.java | 2 - 2 files changed, 33 insertions(+), 34 deletions(-) diff --git a/freemind/controller/Controller.java b/freemind/controller/Controller.java index 2404075..61ced8f 100644 --- a/freemind/controller/Controller.java +++ b/freemind/controller/Controller.java @@ -75,7 +75,8 @@ public class Controller implements MapModuleChangeObserver { private Mode mMode; private FreeMindMain frame; - private MainToolBar toolbar; + private MainToolBar northToolbar; + private MainToolBar southToolbar; private JToolBar filterToolbar; private JPanel northToolbarPanel; private JPanel southToolbarPanel; @@ -89,7 +90,6 @@ public class Controller implements MapModuleChangeObserver { private ModesCreator mModescreator = new ModesCreator(this); private PageFormat pageFormat = null; private PrinterJob printerJob = null; - private Icon bswatch = new BackgroundSwatch(); private Map fontMap = new HashMap(); private JLabel status; @@ -218,33 +218,43 @@ public void init() { } private void generateNorthToolBar() { - toolbar = new MainToolBar(this); + northToolbar = new MainToolBar(this); mFilterController = new FilterController(this); filterToolbar = mFilterController.getFilterToolbar(); northToolbarPanel = new JPanel(new BorderLayout()); getFrame().getContentPane().add(northToolbarPanel, BorderLayout.NORTH); - northToolbarPanel.add(toolbar, BorderLayout.NORTH); + northToolbarPanel.add(northToolbar, BorderLayout.NORTH); northToolbarPanel.add(filterToolbar, BorderLayout.SOUTH); } private void generateSouthToolBar() { + southToolbar = new MainToolBar(this); + southToolbarPanel = new JPanel(new BorderLayout()); - status = new JLabel("!"); - status.setPreferredSize(status.getPreferredSize()); - status.setText(""); - southToolbarPanel.add(status); + initializeStatus(); + southToolbar.add(status); + southToolbar.add(createZoomComboBox()); + southToolbarPanel.add(southToolbar); getFrame().getContentPane().add(southToolbarPanel, BorderLayout.SOUTH); - southToolbarPanel.add(createZoomComboBox()); + + //TODO - investigate if this should be moved to JPanel + //TODO - look into moving this to the MindMapToolbar + } + + private void initializeStatus() { + status = new JLabel("!"); + status.setPreferredSize(status.getPreferredSize()); + status.setText(""); } private JComboBox createZoomComboBox() { JComboBox zoom = new JComboBox(this.getZooms()); - zoom.setPreferredSize(new Dimension(90,15)); zoom.setSelectedItem("100%"); + zoom.setPreferredSize(new Dimension(90, 20)); + zoom.setMaximumSize(zoom.getPreferredSize()); zoom.addItem(userDefinedZoom); - // Focus fix. zoom.setFocusable(false); zoom.addItemListener(e -> { if (e.getStateChange() == ItemEvent.SELECTED) { @@ -511,13 +521,13 @@ public void beforeMapModuleChange(MapModule oldMapModule, Mode oldMode, MapModul } if (oldModeController.getModeToolBar() != null) { - toolbar.remove(oldModeController.getModeToolBar()); - toolbar.activate(true); + northToolbar.remove(oldModeController.getModeToolBar()); + northToolbar.activate(true); } if (oldModeController.getLeftToolBar() != null) { getFrame().getContentPane().remove(oldModeController.getLeftToolBar()); } - toolbar.activate(true); + northToolbar.activate(true); } public void afterMapModuleChange(MapModule oldMapModule, Mode oldMode, MapModule newMapModule, Mode newMode) { @@ -533,9 +543,8 @@ public void afterMapModuleChange(MapModule oldMapModule, Mode oldMode, MapModule generateTopToolbar(newModeController); generateLeftToolbar(newModeController); - - toolbar.validate(); - toolbar.repaint(); + northToolbar.validate(); + northToolbar.repaint(); MenuBar menuBar = getFrame().getFreeMindMenuBar(); menuBar.updateMenus(newModeController); @@ -572,8 +581,8 @@ private ModeController setViewToExistingMap(MapModule newMapModule) { private void generateTopToolbar(ModeController newModeController) { JToolBar newToolBar = newModeController.getModeToolBar(); if (newToolBar != null) { - toolbar.activate(false); - toolbar.add(newToolBar, 0); + northToolbar.activate(false); + northToolbar.add(newToolBar, 0); newToolBar.repaint(); } } @@ -645,14 +654,14 @@ public void setMenubarVisible(boolean visible) { public void setToolbarVisible(boolean visible) { toolbarVisible = visible; - toolbar.setVisible(toolbarVisible); + northToolbar.setVisible(toolbarVisible); } /** - * @return Returns the main toolbar. + * @return Returns the main northToolbar. */ - public JToolBar getToolbar() { - return toolbar; + public JToolBar getNorthToolbar() { + return northToolbar; } public void setLeftToolbarVisible(boolean visible) { @@ -842,7 +851,7 @@ public void setAllActions(boolean enabled) { page.setEnabled(enabled && isPrintingAllowed); close.setEnabled(enabled); moveToRoot.setEnabled(enabled); - toolbar.setAllActions(enabled); + northToolbar.setAllActions(enabled); showSelectionAsRectangle.setEnabled(enabled); } @@ -1797,12 +1806,4 @@ private void storeOptionSplitPanePosition() { + mOptionalSplitPane.getDividerPosition()); } } - - public JPanel getSouthToolbarPanel() { - return southToolbarPanel; - } - - public void setSouthToolbarPanel(JPanel southToolbarPanel) { - this.southToolbarPanel = southToolbarPanel; - } } diff --git a/freemind/modes/mindmapmode/MindMapToolBar.java b/freemind/modes/mindmapmode/MindMapToolBar.java index c6d81f5..2586e56 100644 --- a/freemind/modes/mindmapmode/MindMapToolBar.java +++ b/freemind/modes/mindmapmode/MindMapToolBar.java @@ -157,8 +157,6 @@ public void update(StructuredMenuHolder holder) { label.setToolTipText(Resources.getInstance().getText("mindmapmode_toolbar_font_color")); add(colorCombo); add(Box.createHorizontalGlue()); - addIcon("images/page-zoom.png"); -// add(zoom); // button tool bar. iconToolBar.removeAll();