Search in sources :

Example 21 with YBoxPanel

use of com.mucommander.commons.util.ui.layout.YBoxPanel in project mucommander by mucommander.

the class FileEditorPanel method initUI.

/**
 * Initialises the panel's UI.
 */
private void initUI() {
    // Contains all the configuration elements.
    YBoxPanel configurationPanel;
    // Used to select a font.
    FontChooser fontChooser;
    // Main panel.
    JPanel mainPanel;
    // Font chooser and preview initialisation.
    mainPanel = new JPanel(new BorderLayout());
    fontChooser = createFontChooser(ThemeData.EDITOR_FONT);
    mainPanel.add(createPreviewPanel(), BorderLayout.EAST);
    addFontChooserListener(fontChooser, preview);
    // Configuration panel initialisation.
    configurationPanel = new YBoxPanel();
    configurationPanel.add(fontChooser);
    configurationPanel.addSpace(10);
    configurationPanel.add(createColorsPanel(fontChooser));
    mainPanel.add(configurationPanel, BorderLayout.CENTER);
    // Layout.
    setLayout(new BorderLayout());
    add(mainPanel, BorderLayout.NORTH);
}
Also used : YBoxPanel(com.mucommander.commons.util.ui.layout.YBoxPanel) FontChooser(com.mucommander.ui.chooser.FontChooser)

Example 22 with YBoxPanel

use of com.mucommander.commons.util.ui.layout.YBoxPanel in project mucommander by mucommander.

the class FolderPanePanel method createGeneralPanel.

/**
 * Creates the 'general' theme.
 */
private JPanel createGeneralPanel(FontChooser chooser) {
    YBoxPanel mainPanel;
    JPanel quickSearchPanel;
    ProportionalGridPanel panel;
    JPanel wrapper;
    // Initialises the quicksearch panel.
    panel = new ProportionalGridPanel(4);
    addLabelRow(panel);
    panel.add(addColorButtons(panel, chooser, "theme_editor.quick_search.unmatched_file", ThemeData.FILE_TABLE_UNMATCHED_FOREGROUND_COLOR, ThemeData.FILE_TABLE_UNMATCHED_BACKGROUND_COLOR));
    quickSearchPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    quickSearchPanel.add(panel);
    quickSearchPanel.setBorder(BorderFactory.createTitledBorder(Translator.get("theme_editor.quick_search")));
    // Initialises the panel.
    mainPanel = new YBoxPanel();
    mainPanel.add(chooser);
    mainPanel.addSpace(10);
    mainPanel.add(quickSearchPanel);
    // Wraps everything in a border layout.
    wrapper = new JPanel(new BorderLayout());
    wrapper.add(mainPanel, BorderLayout.NORTH);
    return wrapper;
}
Also used : YBoxPanel(com.mucommander.commons.util.ui.layout.YBoxPanel) ProportionalGridPanel(com.mucommander.commons.util.ui.layout.ProportionalGridPanel)

Example 23 with YBoxPanel

use of com.mucommander.commons.util.ui.layout.YBoxPanel in project mucommander by mucommander.

the class QuestionDialog method init.

protected void init(Component comp, List<DialogAction> actionChoices, int maxNbCols) {
    this.actionChoices.addAll(actionChoices);
    // Sets minimum and maximum dimensions for this dialog
    setMinimumSize(MINIMUM_DIALOG_DIMENSION);
    setMaximumSize(MAXIMUM_DIALOG_DIMENSION);
    mainPanel = new YBoxPanel();
    if (comp != null) {
        mainPanel.addSpace(5);
        mainPanel.add(comp);
        mainPanel.addSpace(10);
    }
    for (DialogAction action : actionChoices) {
        JButton button = new JButton(action.getActionName());
        button.setToolTipText(action.getActionName());
        button.addActionListener((ActionEvent event) -> {
            retValue = action;
            dispose();
        });
        buttons.add(button);
    }
    if (!buttons.isEmpty()) {
        setInitialFocusComponent(buttons.get(0));
    }
    mainPanel.add(new ButtonChoicePanel(buttons, maxNbCols, getRootPane()));
    getContentPane().add(mainPanel, BorderLayout.NORTH);
}
Also used : YBoxPanel(com.mucommander.commons.util.ui.layout.YBoxPanel) ButtonChoicePanel(com.mucommander.commons.util.ui.button.ButtonChoicePanel) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton)

Example 24 with YBoxPanel

use of com.mucommander.commons.util.ui.layout.YBoxPanel in project mucommander by mucommander.

the class MainFrame method init.

private void init(FolderPanel leftFolderPanel, FolderPanel rightFolderPanel) {
    // Set the window icon
    setWindowIcon();
    DesktopManager.customizeMainFrame(this);
    // Enable window resize
    setResizable(true);
    // The toolbar should have no inset, this is why it is left out of the insetsPane
    JPanel contentPane = new JPanel(new BorderLayout());
    setContentPane(contentPane);
    // Initializes the folder panels and file tables.
    this.leftFolderPanel = leftFolderPanel;
    this.rightFolderPanel = rightFolderPanel;
    leftTable = leftFolderPanel.getFileTable();
    rightTable = rightFolderPanel.getFileTable();
    activeTable = leftTable;
    // Create the toolbar and corresponding panel wrapping it, and show it only if it hasn't been disabled in the
    // preferences.
    // Note: Toolbar.setVisible() has to be called no matter if Toolbar is visible or not, in order for it to be
    // properly initialized
    this.toolbar = new ToolBar(this);
    this.toolbarPanel = ToolbarMoreButton.wrapToolBar(toolbar);
    this.toolbarPanel.setVisible(MuConfigurations.getPreferences().getVariable(MuPreference.TOOLBAR_VISIBLE, MuPreferences.DEFAULT_TOOLBAR_VISIBLE));
    contentPane.add(toolbarPanel, BorderLayout.NORTH);
    JPanel insetsPane = new JPanel(new BorderLayout()) {

        // Add an x=3,y=3 gap around content pane
        @Override
        public Insets getInsets() {
            // No top inset
            return new Insets(0, 3, 3, 3);
        }
    };
    // Below the toolbar there is the pane with insets
    contentPane.add(insetsPane, BorderLayout.CENTER);
    // Listen to location change events to display the current folder in the window's title
    leftFolderPanel.getLocationManager().addLocationListener(this);
    rightFolderPanel.getLocationManager().addLocationListener(this);
    // Create menu bar (has to be created after toolbar)
    MainMenuBar menuBar = new MainMenuBar(this);
    setJMenuBar(menuBar);
    // Create the split pane that separates folder panels and allows to resize how much space is allocated to the
    // both of them. The split orientation is loaded from and saved to the preferences.
    // Note: the vertical/horizontal terminology used in muCommander is just the opposite of the one used
    // in JSplitPane which is anti-natural / confusing.
    splitPane = new ProportionalSplitPane(this, MuSnapshot.getSnapshot().getVariable(MuSnapshot.getSplitOrientation(0), MuSnapshot.DEFAULT_SPLIT_ORIENTATION).equals(MuSnapshot.VERTICAL_SPLIT_ORIENTATION) ? JSplitPane.HORIZONTAL_SPLIT : JSplitPane.VERTICAL_SPLIT, false, MainFrame.this.leftFolderPanel, MainFrame.this.rightFolderPanel) {

        // We don't want any extra space around split pane
        @Override
        public Insets getInsets() {
            return new Insets(0, 0, 0, 0);
        }
    };
    // Remove any default border the split pane has
    splitPane.setBorder(null);
    // Adds buttons that allow to collapse and expand the split pane in both directions
    splitPane.setOneTouchExpandable(true);
    // Disable all the JSplitPane accessibility shortcuts that are registered by default, as some of them
    // conflict with default mucommander action shortcuts (e.g. F6 and F8)
    splitPane.disableAccessibilityShortcuts();
    // Split pane will be given any extra space
    insetsPane.add(splitPane, BorderLayout.CENTER);
    // Add a 2-pixel gap between the file table and status bar
    YBoxPanel southPanel = new YBoxPanel();
    southPanel.addSpace(2);
    // Add status bar
    this.statusBar = new StatusBar(this);
    southPanel.add(statusBar);
    // Show command bar only if it hasn't been disabled in the preferences
    this.commandBar = new CommandBar(this);
    // Note: CommandBar.setVisible() has to be called no matter if CommandBar is visible or not, in order for it to be properly initialized
    this.commandBar.setVisible(MuConfigurations.getPreferences().getVariable(MuPreference.COMMAND_BAR_VISIBLE, MuPreferences.DEFAULT_COMMAND_BAR_VISIBLE));
    southPanel.add(commandBar);
    insetsPane.add(southPanel, BorderLayout.SOUTH);
    // Perform CloseAction when the user asked the window to close
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent e) {
            ActionManager.performAction(CloseWindowAction.Descriptor.ACTION_ID, MainFrame.this);
        }
    });
    ActionKeymap.registerActions(this);
    // Fire table change events on registered ActivePanelListener instances, to notify of the initial active table.
    fireActivePanelChanged(activeTable.getFolderPanel());
    // Set the custom FocusTraversalPolicy that manages focus for both FolderPanel and their sub components.
    setFocusTraversalPolicy(new CustomFocusTraversalPolicy());
}
Also used : JPanel(javax.swing.JPanel) Insets(java.awt.Insets) CommandBar(com.mucommander.ui.main.commandbar.CommandBar) WindowAdapter(java.awt.event.WindowAdapter) BorderLayout(java.awt.BorderLayout) YBoxPanel(com.mucommander.commons.util.ui.layout.YBoxPanel) MainMenuBar(com.mucommander.ui.main.menu.MainMenuBar) WindowEvent(java.awt.event.WindowEvent) ToolBar(com.mucommander.ui.main.toolbar.ToolBar) ProportionalSplitPane(com.mucommander.ui.layout.ProportionalSplitPane)

Example 25 with YBoxPanel

use of com.mucommander.commons.util.ui.layout.YBoxPanel in project mucommander by mucommander.

the class InitialSetupDialog method createMainPanel.

/**
 * Creates the dialog's main panel.
 * @return the dialog's main panel.
 */
private JPanel createMainPanel() {
    YBoxPanel mainPanel;
    JPanel okPanel;
    mainPanel = new YBoxPanel();
    mainPanel.add(new JLabel(Translator.get("setup.intro")));
    mainPanel.addSpace(10);
    mainPanel.add(createThemePanel());
    mainPanel.addSpace(10);
    mainPanel.add(createLookAndFeelPanel());
    mainPanel.addSpace(10);
    okPanel = new JPanel();
    okPanel.setLayout(new FlowLayout(FlowLayout.TRAILING));
    okPanel.add(okButton = new JButton(Translator.get("ok")));
    okButton.addActionListener(this);
    mainPanel.add(okPanel);
    return mainPanel;
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) YBoxPanel(com.mucommander.commons.util.ui.layout.YBoxPanel) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel)

Aggregations

YBoxPanel (com.mucommander.commons.util.ui.layout.YBoxPanel)26 JPanel (javax.swing.JPanel)11 JButton (javax.swing.JButton)8 JLabel (javax.swing.JLabel)7 FlowLayout (java.awt.FlowLayout)6 ButtonChoicePanel (com.mucommander.commons.util.ui.button.ButtonChoicePanel)4 ProportionalGridPanel (com.mucommander.commons.util.ui.layout.ProportionalGridPanel)4 FontChooser (com.mucommander.ui.chooser.FontChooser)4 BorderLayout (java.awt.BorderLayout)4 ActionEvent (java.awt.event.ActionEvent)3 JCheckBox (javax.swing.JCheckBox)3 JScrollPane (javax.swing.JScrollPane)3 XAlignedComponentPanel (com.mucommander.commons.util.ui.layout.XAlignedComponentPanel)2 CollapseExpandButton (com.mucommander.ui.button.CollapseExpandButton)2 SpinningDial (com.mucommander.ui.icon.SpinningDial)2 InformationPane (com.mucommander.ui.layout.InformationPane)2 Container (java.awt.Container)2 Dimension (java.awt.Dimension)2 ActionListener (java.awt.event.ActionListener)2 WindowAdapter (java.awt.event.WindowAdapter)2