List of usage examples for javax.swing JLabel getMinimumSize
@Transient
public Dimension getMinimumSize()
null
value just returns it. From source file:com.opendoorlogistics.studio.scripts.list.ScriptsPanel.java
/** * Create the panel.//from w w w.j a v a2s . c o m */ public ScriptsPanel(ODLApi api, File directory, ScriptUIManager launchScriptEditor) { this.scriptUIManager = launchScriptEditor; this.api = api; // find a sensible directory if (directory == null) { directory = new File(ScriptConstants.DIRECTORY); if (!directory.exists()) { directory = new File(""); } } this.directory = directory; setLayout(new BorderLayout(0, 0)); // Add directory browser and label at the top in their own panel. // Label is wrapped in a panel because alignment is being ignored and this at least makes it properly centred. // See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4275005 boolean lockedDir = scriptUIManager.getAppPermissions().isScriptDirectoryLocked(); if (!lockedDir) { JLabel lblLabel = new JLabel("Scripts directory"); JPanel labelPanel = new JPanel(new BorderLayout()); labelPanel.add(lblLabel, BorderLayout.CENTER); labelPanel.setMaximumSize(lblLabel.getMinimumSize()); dirChooser = new FileBrowserPanel(directory.getAbsolutePath(), new FilenameChangeListener() { @Override public void filenameChanged(String newFilename) { ScriptsPanel.this.directory = new File(newFilename); onDirectoryChanged(ScriptsPanel.this.directory); } }, true, "Select"); JPanel topPanel = LayoutUtils.createVerticalBoxLayout(labelPanel, dirChooser); add(topPanel, BorderLayout.NORTH); } else { dirChooser = null; } // add toolbar at the bottom JToolBar toolBar = new JToolBar(); toolBar.setFloatable(false); add(toolBar, BorderLayout.SOUTH); // create all actions and add as buttons and menu items popup = new JPopupMenu(); actions = createActions(launchScriptEditor.getAppPermissions()); for (Action action : actions) { toolBar.add(action); popup.add(action); } // add list in the centre scriptsTree = new ScriptsTree(scriptUIManager, popup); scriptsTree.addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { ScriptsPanel.this.updateAppearance(); } }); add(scriptsTree.getScrollPane(), BorderLayout.CENTER); // // create selection changed listener on the list // listControl.addListSelectionListener(new ListSelectionListener() { // // @Override // public void valueChanged(ListSelectionEvent e) { // updateAppearance(); // } // }); // finally file the list onDirectoryChanged(directory); }