Example usage for javax.swing ScrollPaneConstants HORIZONTAL_SCROLLBAR_AS_NEEDED

List of usage examples for javax.swing ScrollPaneConstants HORIZONTAL_SCROLLBAR_AS_NEEDED

Introduction

In this page you can find the example usage for javax.swing ScrollPaneConstants HORIZONTAL_SCROLLBAR_AS_NEEDED.

Prototype

int HORIZONTAL_SCROLLBAR_AS_NEEDED

To view the source code for javax.swing ScrollPaneConstants HORIZONTAL_SCROLLBAR_AS_NEEDED.

Click Source Link

Document

Used to set the horizontal scroll bar policy so that horizontal scrollbars are displayed only when needed.

Usage

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstSwing.CFAstSwingTenantPickerJPanel.java

public CFAstSwingTenantPickerJPanel(ICFAstSwingSchema argSchema, ICFAstTenantObj argFocus,
        ICFAstClusterObj argContainer, Collection<ICFAstTenantObj> argDataCollection,
        ICFAstSwingTenantChosen whenChosen) {
    super();/*from   w  w w .jav a2  s .  co m*/
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    if (whenChosen == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 5,
                "whenChosen");
    }
    invokeWhenChosen = whenChosen;
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    swingFocus = argFocus;
    swingContainer = argContainer;
    setSwingDataCollection(argDataCollection);
    dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel());
    dataTable.addMouseListener(getDataListMouseAdapter());
    dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    dataTable.setUpdateSelectionOnSort(true);
    dataTable.setRowHeight(25);
    getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener());
    dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    dataScrollPane.setColumnHeader(new JViewport() {
        @Override
        public Dimension getPreferredSize() {
            Dimension sz = super.getPreferredSize();
            sz.height = 25;
            return (sz);
        }
    });
    dataTable.setFillsViewportHeight(true);
    actionCancel = new ActionCancel();
    buttonCancel = new JButton(actionCancel);
    actionChooseNone = new ActionChooseNone();
    buttonChooseNone = new JButton(actionChooseNone);
    actionChooseSelected = new ActionChooseSelectedTenant();
    buttonChooseSelected = new JButton(actionChooseSelected);
    // Do initial layout
    setSize(1024, 480);
    add(buttonChooseNone);
    add(buttonChooseSelected);
    add(buttonCancel);
    add(dataScrollPane);
    dataScrollPane.setBounds(0, 35, 1024, 455);
    doLayout();
    setSwingFocusAsTenant(argFocus);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstSwing.CFAstSwingVersionPickerJPanel.java

public CFAstSwingVersionPickerJPanel(ICFAstSwingSchema argSchema, ICFAstVersionObj argFocus,
        ICFLibAnyObj argContainer, Collection<ICFAstVersionObj> argDataCollection,
        ICFAstSwingVersionChosen whenChosen) {
    super();//from  ww  w .ja  v a2 s . co m
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    if (whenChosen == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 5,
                "whenChosen");
    }
    invokeWhenChosen = whenChosen;
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    swingFocus = argFocus;
    swingContainer = argContainer;
    setSwingDataCollection(argDataCollection);
    dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel());
    dataTable.addMouseListener(getDataListMouseAdapter());
    dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    dataTable.setUpdateSelectionOnSort(true);
    dataTable.setRowHeight(25);
    getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener());
    dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    dataScrollPane.setColumnHeader(new JViewport() {
        @Override
        public Dimension getPreferredSize() {
            Dimension sz = super.getPreferredSize();
            sz.height = 25;
            return (sz);
        }
    });
    dataTable.setFillsViewportHeight(true);
    actionCancel = new ActionCancel();
    buttonCancel = new JButton(actionCancel);
    actionChooseNone = new ActionChooseNone();
    buttonChooseNone = new JButton(actionChooseNone);
    actionChooseSelected = new ActionChooseSelectedVersion();
    buttonChooseSelected = new JButton(actionChooseSelected);
    // Do initial layout
    setSize(1024, 480);
    add(buttonChooseNone);
    add(buttonChooseSelected);
    add(buttonCancel);
    add(dataScrollPane);
    dataScrollPane.setBounds(0, 35, 1024, 455);
    doLayout();
    setSwingFocusAsVersion(argFocus);
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccSwing.CFAccSwingVersionPickerJPanel.java

public CFAccSwingVersionPickerJPanel(ICFAccSwingSchema argSchema, ICFAccVersionObj argFocus,
        ICFLibAnyObj2 argContainer, Collection<ICFAccVersionObj> argDataCollection,
        ICFAccSwingVersionChosen whenChosen) {
    super();//from ww w  .  j a  va 2s  . c o m
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    if (whenChosen == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 5,
                "whenChosen");
    }
    invokeWhenChosen = whenChosen;
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    swingFocus = argFocus;
    swingContainer = argContainer;
    setSwingDataCollection(argDataCollection);
    dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel());
    dataTable.addMouseListener(getDataListMouseAdapter());
    dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    dataTable.setUpdateSelectionOnSort(true);
    dataTable.setRowHeight(25);
    getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener());
    dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    dataScrollPane.setColumnHeader(new JViewport() {
        @Override
        public Dimension getPreferredSize() {
            Dimension sz = super.getPreferredSize();
            sz.height = 25;
            return (sz);
        }
    });
    dataTable.setFillsViewportHeight(true);
    actionCancel = new ActionCancel();
    buttonCancel = new JButton(actionCancel);
    actionChooseNone = new ActionChooseNone();
    buttonChooseNone = new JButton(actionChooseNone);
    actionChooseSelected = new ActionChooseSelectedVersion();
    buttonChooseSelected = new JButton(actionChooseSelected);
    // Do initial layout
    setSize(1024, 480);
    add(buttonChooseNone);
    add(buttonChooseSelected);
    add(buttonCancel);
    add(dataScrollPane);
    dataScrollPane.setBounds(0, 35, 1024, 455);
    doLayout();
    setSwingFocusAsVersion(argFocus);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstSwing.CFAstSwingVersionPickerJPanel.java

public CFAstSwingVersionPickerJPanel(ICFAstSwingSchema argSchema, ICFAstVersionObj argFocus,
        ICFLibAnyObj2 argContainer, Collection<ICFAstVersionObj> argDataCollection,
        ICFAstSwingVersionChosen whenChosen) {
    super();/*from   w  ww .  java 2 s . c o  m*/
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    if (whenChosen == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 5,
                "whenChosen");
    }
    invokeWhenChosen = whenChosen;
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    swingFocus = argFocus;
    swingContainer = argContainer;
    setSwingDataCollection(argDataCollection);
    dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel());
    dataTable.addMouseListener(getDataListMouseAdapter());
    dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    dataTable.setUpdateSelectionOnSort(true);
    dataTable.setRowHeight(25);
    getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener());
    dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    dataScrollPane.setColumnHeader(new JViewport() {
        @Override
        public Dimension getPreferredSize() {
            Dimension sz = super.getPreferredSize();
            sz.height = 25;
            return (sz);
        }
    });
    dataTable.setFillsViewportHeight(true);
    actionCancel = new ActionCancel();
    buttonCancel = new JButton(actionCancel);
    actionChooseNone = new ActionChooseNone();
    buttonChooseNone = new JButton(actionChooseNone);
    actionChooseSelected = new ActionChooseSelectedVersion();
    buttonChooseSelected = new JButton(actionChooseSelected);
    // Do initial layout
    setSize(1024, 480);
    add(buttonChooseNone);
    add(buttonChooseSelected);
    add(buttonCancel);
    add(dataScrollPane);
    dataScrollPane.setBounds(0, 35, 1024, 455);
    doLayout();
    setSwingFocusAsVersion(argFocus);
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccSwing.CFAccSwingMemoTagPickerJPanel.java

public CFAccSwingMemoTagPickerJPanel(ICFAccSwingSchema argSchema, ICFAccMemoTagObj argFocus,
        ICFAccMemoObj argContainer, Collection<ICFAccMemoTagObj> argDataCollection,
        ICFAccSwingMemoTagChosen whenChosen) {
    super();//from   w  ww. j  a  v  a2 s . co  m
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    if (whenChosen == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 5,
                "whenChosen");
    }
    invokeWhenChosen = whenChosen;
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    swingFocus = argFocus;
    swingContainer = argContainer;
    setSwingDataCollection(argDataCollection);
    dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel());
    dataTable.addMouseListener(getDataListMouseAdapter());
    dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    dataTable.setUpdateSelectionOnSort(true);
    dataTable.setRowHeight(25);
    getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener());
    dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    dataScrollPane.setColumnHeader(new JViewport() {
        @Override
        public Dimension getPreferredSize() {
            Dimension sz = super.getPreferredSize();
            sz.height = 25;
            return (sz);
        }
    });
    dataTable.setFillsViewportHeight(true);
    actionCancel = new ActionCancel();
    buttonCancel = new JButton(actionCancel);
    actionChooseNone = new ActionChooseNone();
    buttonChooseNone = new JButton(actionChooseNone);
    actionChooseSelected = new ActionChooseSelectedMemoTag();
    buttonChooseSelected = new JButton(actionChooseSelected);
    // Do initial layout
    setSize(1024, 480);
    add(buttonChooseNone);
    add(buttonChooseSelected);
    add(buttonCancel);
    add(dataScrollPane);
    dataScrollPane.setBounds(0, 35, 1024, 455);
    doLayout();
    setSwingFocusAsMemoTag(argFocus);
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccSwing.CFAccSwingClusterPickerJPanel.java

public CFAccSwingClusterPickerJPanel(ICFAccSwingSchema argSchema, ICFAccClusterObj argFocus,
        ICFLibAnyObj2 argContainer, Collection<ICFAccClusterObj> argDataCollection,
        ICFAccSwingClusterChosen whenChosen) {
    super();// ww w .  j  a v  a2 s .  c o  m
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    if (whenChosen == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 5,
                "whenChosen");
    }
    invokeWhenChosen = whenChosen;
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    swingFocus = argFocus;
    swingContainer = argContainer;
    setSwingDataCollection(argDataCollection);
    dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel());
    dataTable.addMouseListener(getDataListMouseAdapter());
    dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    dataTable.setUpdateSelectionOnSort(true);
    dataTable.setRowHeight(25);
    getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener());
    dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    dataScrollPane.setColumnHeader(new JViewport() {
        @Override
        public Dimension getPreferredSize() {
            Dimension sz = super.getPreferredSize();
            sz.height = 25;
            return (sz);
        }
    });
    dataTable.setFillsViewportHeight(true);
    actionCancel = new ActionCancel();
    buttonCancel = new JButton(actionCancel);
    actionChooseNone = new ActionChooseNone();
    buttonChooseNone = new JButton(actionChooseNone);
    actionChooseSelected = new ActionChooseSelectedCluster();
    buttonChooseSelected = new JButton(actionChooseSelected);
    // Do initial layout
    setSize(1024, 480);
    add(buttonChooseNone);
    add(buttonChooseSelected);
    add(buttonCancel);
    add(dataScrollPane);
    dataScrollPane.setBounds(0, 35, 1024, 455);
    doLayout();
    setSwingFocusAsCluster(argFocus);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstSwing.CFAstSwingClusterPickerJPanel.java

public CFAstSwingClusterPickerJPanel(ICFAstSwingSchema argSchema, ICFAstClusterObj argFocus,
        ICFLibAnyObj2 argContainer, Collection<ICFAstClusterObj> argDataCollection,
        ICFAstSwingClusterChosen whenChosen) {
    super();//ww  w.j  a v a2  s  . com
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    if (whenChosen == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 5,
                "whenChosen");
    }
    invokeWhenChosen = whenChosen;
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    swingFocus = argFocus;
    swingContainer = argContainer;
    setSwingDataCollection(argDataCollection);
    dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel());
    dataTable.addMouseListener(getDataListMouseAdapter());
    dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    dataTable.setUpdateSelectionOnSort(true);
    dataTable.setRowHeight(25);
    getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener());
    dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    dataScrollPane.setColumnHeader(new JViewport() {
        @Override
        public Dimension getPreferredSize() {
            Dimension sz = super.getPreferredSize();
            sz.height = 25;
            return (sz);
        }
    });
    dataTable.setFillsViewportHeight(true);
    actionCancel = new ActionCancel();
    buttonCancel = new JButton(actionCancel);
    actionChooseNone = new ActionChooseNone();
    buttonChooseNone = new JButton(actionChooseNone);
    actionChooseSelected = new ActionChooseSelectedCluster();
    buttonChooseSelected = new JButton(actionChooseSelected);
    // Do initial layout
    setSize(1024, 480);
    add(buttonChooseNone);
    add(buttonChooseSelected);
    add(buttonCancel);
    add(dataScrollPane);
    dataScrollPane.setBounds(0, 35, 1024, 455);
    doLayout();
    setSwingFocusAsCluster(argFocus);
}

From source file:net.pms.newgui.LooksFrame.java

/**
 * Constructs a <code>DemoFrame</code>, configures the UI,
 * and builds the content./*from w  ww.  ja va  2  s  .  com*/
 */
public LooksFrame(AutoUpdater autoUpdater, @Nonnull PmsConfiguration configuration,
        @Nonnull WindowPropertiesConfiguration windowConfiguration) {
    super(windowConfiguration.getGraphicsConfiguration());
    if (configuration == null) {
        throw new IllegalArgumentException("configuration can't be null");
    }
    setResizable(true);
    windowProperties = new WindowProperties(this, STANDARD_SIZE, MINIMUM_SIZE, windowConfiguration);
    this.autoUpdater = autoUpdater;
    this.configuration = configuration;
    assert this.configuration != null;
    setMinimumSize(MINIMUM_SIZE);
    Options.setDefaultIconSize(new Dimension(18, 18));
    Options.setUseNarrowButtons(true);

    // Set view level, can be omitted if ViewLevel is implemented in configuration
    // by setting the view level as variable initialization
    if (configuration.isHideAdvancedOptions()) {
        viewLevel = ViewLevel.NORMAL;
    } else {
        viewLevel = ViewLevel.ADVANCED;
    }

    // Global options
    Options.setTabIconsEnabled(true);
    UIManager.put(Options.POPUP_DROP_SHADOW_ENABLED_KEY, null);

    // Swing Settings
    initializeLookAndFeel();

    // wait till the look and feel has been initialized before (possibly) displaying the update notification dialog
    if (autoUpdater != null) {
        autoUpdater.addObserver(this);
        autoUpdater.pollServer();
    }

    // Shared Fonts
    final Integer twelve = Integer.valueOf(12);
    final Integer fontPlain = Integer.valueOf(Font.PLAIN);
    final Integer fontBold = Integer.valueOf(Font.BOLD);

    LazyValue dialogPlain12 = new LazyValue() {
        @Override
        public Object createValue(UIDefaults t) {
            return new FontUIResource(Font.DIALOG, fontPlain, twelve);
        }
    };

    LazyValue sansSerifPlain12 = new LazyValue() {
        @Override
        public Object createValue(UIDefaults t) {
            return new FontUIResource(Font.SANS_SERIF, fontPlain, twelve);
        }
    };

    LazyValue monospacedPlain12 = new LazyValue() {
        @Override
        public Object createValue(UIDefaults t) {
            return new FontUIResource(Font.MONOSPACED, fontPlain, twelve);
        }
    };

    LazyValue dialogBold12 = new LazyValue() {
        @Override
        public Object createValue(UIDefaults t) {
            return new FontUIResource(Font.DIALOG, fontBold, twelve);
        }
    };

    Object MenuFont = dialogPlain12;
    Object FixedControlFont = monospacedPlain12;
    Object ControlFont = dialogPlain12;
    Object MessageFont = dialogPlain12;
    Object WindowFont = dialogBold12;
    Object ToolTipFont = sansSerifPlain12;
    Object IconFont = ControlFont;

    // Override our fonts with a unicode font for languages with special characters
    final String language = configuration.getLanguageTag();
    if (language != null && (language.equals("ja") || language.startsWith("zh") || language.equals("ko"))) {
        // http://propedit.sourceforge.jp/propertieseditor.jnlp
        MenuFont = sansSerifPlain12;
        FixedControlFont = sansSerifPlain12;
        ControlFont = sansSerifPlain12;
        MessageFont = sansSerifPlain12;
        WindowFont = sansSerifPlain12;
        IconFont = sansSerifPlain12;
    }

    UIManager.put("Button.font", ControlFont);
    UIManager.put("CheckBox.font", ControlFont);
    UIManager.put("CheckBoxMenuItem.font", MenuFont);
    UIManager.put("ComboBox.font", ControlFont);
    UIManager.put("EditorPane.font", ControlFont);
    UIManager.put("FileChooser.listFont", IconFont);
    UIManager.put("FormattedTextField.font", ControlFont);
    UIManager.put("InternalFrame.titleFont", WindowFont);
    UIManager.put("Label.font", ControlFont);
    UIManager.put("List.font", ControlFont);
    UIManager.put("PopupMenu.font", MenuFont);
    UIManager.put("Menu.font", MenuFont);
    UIManager.put("MenuBar.font", MenuFont);
    UIManager.put("MenuItem.font", MenuFont);
    UIManager.put("MenuItem.acceleratorFont", MenuFont);
    UIManager.put("RadioButton.font", ControlFont);
    UIManager.put("RadioButtonMenuItem.font", MenuFont);
    UIManager.put("OptionPane.font", MessageFont);
    UIManager.put("OptionPane.messageFont", MessageFont);
    UIManager.put("OptionPane.buttonFont", MessageFont);
    UIManager.put("Panel.font", ControlFont);
    UIManager.put("PasswordField.font", ControlFont);
    UIManager.put("ProgressBar.font", ControlFont);
    UIManager.put("ScrollPane.font", ControlFont);
    UIManager.put("Slider.font", ControlFont);
    UIManager.put("Spinner.font", ControlFont);
    UIManager.put("TabbedPane.font", ControlFont);
    UIManager.put("Table.font", ControlFont);
    UIManager.put("TableHeader.font", ControlFont);
    UIManager.put("TextArea.font", FixedControlFont);
    UIManager.put("TextField.font", ControlFont);
    UIManager.put("TextPane.font", ControlFont);
    UIManager.put("TitledBorder.font", ControlFont);
    UIManager.put("ToggleButton.font", ControlFont);
    UIManager.put("ToolBar.font", MenuFont);
    UIManager.put("ToolTip.font", ToolTipFont);
    UIManager.put("Tree.font", ControlFont);
    UIManager.put("Viewport.font", ControlFont);

    setTitle("Test");
    setIconImage(readImageIcon("icon-32.png").getImage());

    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    JComponent jp = buildContent();
    String showScrollbars = System.getProperty("scrollbars", "").toLowerCase();

    /**
     * Handle scrollbars:
     *
     * 1) forced scrollbars (-Dscrollbars=true): always display them
     * 2) optional scrollbars (-Dscrollbars=optional): display them as needed
     * 3) otherwise (default): don't display them
     */
    switch (showScrollbars) {
    case "true":
        setContentPane(new JScrollPane(jp, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
                ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS));
        break;
    case "optional":
        setContentPane(new JScrollPane(jp, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
                ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED));
        break;
    default:
        setContentPane(jp);
        break;
    }

    String projectName = PropertiesUtil.getProjectProperties().get("project.name");
    String projectVersion = PropertiesUtil.getProjectProperties().get("project.version");
    String title = projectName + " " + projectVersion;

    // If the version contains a "-" (e.g. "1.50.1-SNAPSHOT" or "1.50.1-beta1"), add a warning message
    if (projectVersion.indexOf('-') > -1) {
        title = title + " - " + Messages.getString("LooksFrame.26");
    }

    if (PMS.getTraceMode() == 2) {
        // Forced trace mode
        title = title + "  [" + Messages.getString("TracesTab.10").toUpperCase() + "]";
    }

    setTitle(title);
    setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);

    // Display tooltips immediately and for a long time
    ToolTipManager.sharedInstance().setInitialDelay(400);
    ToolTipManager.sharedInstance().setDismissDelay(60000);
    ToolTipManager.sharedInstance().setReshowDelay(400);

    if (!configuration.isMinimized() && System.getProperty(START_SERVICE) == null) {
        setVisible(true);
    }
    BasicSystemUtils.INSTANCE.addSystemTray(this);
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccSwing.CFAccSwingPhoneTagPickerJPanel.java

public CFAccSwingPhoneTagPickerJPanel(ICFAccSwingSchema argSchema, ICFAccPhoneTagObj argFocus,
        ICFAccPhoneObj argContainer, Collection<ICFAccPhoneTagObj> argDataCollection,
        ICFAccSwingPhoneTagChosen whenChosen) {
    super();/*from  w  ww . ja va2s.c  o m*/
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    if (whenChosen == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 5,
                "whenChosen");
    }
    invokeWhenChosen = whenChosen;
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    swingFocus = argFocus;
    swingContainer = argContainer;
    setSwingDataCollection(argDataCollection);
    dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel());
    dataTable.addMouseListener(getDataListMouseAdapter());
    dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    dataTable.setUpdateSelectionOnSort(true);
    dataTable.setRowHeight(25);
    getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener());
    dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    dataScrollPane.setColumnHeader(new JViewport() {
        @Override
        public Dimension getPreferredSize() {
            Dimension sz = super.getPreferredSize();
            sz.height = 25;
            return (sz);
        }
    });
    dataTable.setFillsViewportHeight(true);
    actionCancel = new ActionCancel();
    buttonCancel = new JButton(actionCancel);
    actionChooseNone = new ActionChooseNone();
    buttonChooseNone = new JButton(actionChooseNone);
    actionChooseSelected = new ActionChooseSelectedPhoneTag();
    buttonChooseSelected = new JButton(actionChooseSelected);
    // Do initial layout
    setSize(1024, 480);
    add(buttonChooseNone);
    add(buttonChooseSelected);
    add(buttonCancel);
    add(dataScrollPane);
    dataScrollPane.setBounds(0, 35, 1024, 455);
    doLayout();
    setSwingFocusAsPhoneTag(argFocus);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSwing.CFAsteriskSwingConfigurationFilePickerJPanel.java

public CFAsteriskSwingConfigurationFilePickerJPanel(ICFAsteriskSwingSchema argSchema,
        ICFAsteriskConfigurationFileObj argFocus, ICFSecurityHostNodeObj argContainer,
        Collection<ICFAsteriskConfigurationFileObj> argDataCollection,
        ICFAsteriskSwingConfigurationFileChosen whenChosen) {
    super();/*from w  w  w .  ja v  a2  s  . c  o  m*/
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    if (whenChosen == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 5,
                "whenChosen");
    }
    invokeWhenChosen = whenChosen;
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    swingFocus = argFocus;
    swingContainer = argContainer;
    setSwingDataCollection(argDataCollection);
    dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel());
    dataTable.addMouseListener(getDataListMouseAdapter());
    dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    dataTable.setUpdateSelectionOnSort(true);
    dataTable.setRowHeight(25);
    getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener());
    dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    dataScrollPane.setColumnHeader(new JViewport() {
        @Override
        public Dimension getPreferredSize() {
            Dimension sz = super.getPreferredSize();
            sz.height = 25;
            return (sz);
        }
    });
    dataTable.setFillsViewportHeight(true);
    actionCancel = new ActionCancel();
    buttonCancel = new JButton(actionCancel);
    actionChooseNone = new ActionChooseNone();
    buttonChooseNone = new JButton(actionChooseNone);
    actionChooseSelected = new ActionChooseSelectedConfigurationFile();
    buttonChooseSelected = new JButton(actionChooseSelected);
    // Do initial layout
    setSize(1024, 480);
    add(buttonChooseNone);
    add(buttonChooseSelected);
    add(buttonCancel);
    add(dataScrollPane);
    dataScrollPane.setBounds(0, 35, 1024, 455);
    doLayout();
    setSwingFocusAsConfigurationFile(argFocus);
}