com.alee.global.StyleConstants Java Examples

The following examples show how to use com.alee.global.StyleConstants. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DeviceSettingDialog.java    From CXTouch with GNU General Public License v3.0 6 votes vote down vote up
private JPanel createWindowPanel() {
    JPanel pane = new JPanel();
    pane.setLayout(new JideBoxLayout(pane, JideBoxLayout.Y_AXIS, 10));
    Border outBorder= BorderFactory.createLineBorder(StyleConstants.borderColor, 1, true);
    Border inBorder = BorderFactory.createEmptyBorder(10, 10,10,10);
    pane.setBorder(BorderFactory.createCompoundBorder(outBorder, inBorder));

    //toolbar
    String toolbarLabel = stringMgr.getString("device.setting.window.toolbar.label");
    toolBarDisplayField = new JCheckBox(toolbarLabel);
    pane.add(toolBarDisplayField, JideBoxLayout.FIX);
    //navi bar
    String navibarLabel = stringMgr.getString("device.setting.window.navibar.label");
    naviBarDisplayField = new JCheckBox(navibarLabel);
    pane.add(naviBarDisplayField, JideBoxLayout.FIX);
    //always top
    String alwaysTopLabel = stringMgr.getString("device.setting.window.alwaystop.label");
    alwaysTopField = new JCheckBox(alwaysTopLabel);
    pane.add(alwaysTopField, JideBoxLayout.FIX);

    return pane;
}
 
Example #2
Source File: CXLookAndFeel.java    From CXTouch with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void initialize() {
    WebButtonStyle.margin = new Insets(2, 8, 2, 8);
    WebToolBarStyle.borderColor = StyleConstants.LIGHT_ALPHA;
    WebTreeStyle.selectionStyle = TreeSelectionStyle.group;

    //font
    Font defaultFont = FontUtil.getDefaultFont(12);
    textPaneFont = defaultFont;
    editorPaneFont = defaultFont;
    globalControlFont = defaultFont;
    globalTooltipFont = defaultFont;
    globalAlertFont = defaultFont;
    globalMenuFont = defaultFont;
    globalAcceleratorFont = defaultFont;
    globalTitleFont = defaultFont;
    globalTextFont = defaultFont;
    toolTipFont =  defaultFont;

    super.initialize();
}
 
Example #3
Source File: MainFrame.java    From CXTouch with GNU General Public License v3.0 5 votes vote down vote up
private void initView() {
    JPanel content = new JPanel();
    setContentPane(content);
    content.setBorder(BorderFactory.createEmptyBorder(10, 15,10,15));
    content.setBackground(Color.WHITE);
    content.setLayout(new JideBoxLayout(content, JideBoxLayout.PAGE_AXIS, 6));

    //device list panel
    JLabel label = new JLabel(stringMgr.getString("panel.title.devicelist"));
    content.add(label, JideBoxLayout.FIX);
    Border border = BorderFactory.createLineBorder(StyleConstants.borderColor, 1, true);
    deviceListPane = new JPanel() {
        @Override
        public Dimension getPreferredSize() {
            Dimension dim = super.getPreferredSize();
            if (dim.height < 50) {
                dim.height = 50;
            }

            return dim;
        }
    };
    deviceListPane.setBorder(border);
    deviceListPane.setLayout(new JideBoxLayout(deviceListPane, JideBoxLayout.PAGE_AXIS));
    deviceOverlayable = new DefaultOverlayable(deviceListPane);
    deviceOverlayable.addOverlayComponent(createNoDevicePane());
    deviceOverlayable.setOverlayVisible(false);
    content.add(deviceOverlayable, JideBoxLayout.FIX);

    //separator
    content.add(Box.createVerticalStrut(30), JideBoxLayout.FIX);

    //information
    String infoLabel = stringMgr.getString("panel.title.info");
    content.add(new JLabel(infoLabel), JideBoxLayout.FIX);
    content.add(createInfoPane(), JideBoxLayout.FIX);
}
 
Example #4
Source File: MainFrame.java    From CXTouch with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void mouseEntered(MouseEvent e) {
    JComponent component = (JComponent)e.getSource();
    DeviceComponent parent = GUIUtil.getUpParent(component, DeviceComponent.class);
    if (parent != null) {
        parent.setBackground(StyleConstants.backgroundColor);
    }
}
 
Example #5
Source File: DeviceSettingDialog.java    From CXTouch with GNU General Public License v3.0 5 votes vote down vote up
private void initView() {
    JPanel contentPane = new JPanel();
    setContentPane(new JScrollPane(contentPane));
    contentPane.setLayout(new JideBoxLayout(contentPane, JideBoxLayout.PAGE_AXIS));
    contentPane.setBorder(BorderFactory.createEmptyBorder(10, 14,10,14));
    contentPane.setBackground(Color.WHITE);
    //name panel
    JPanel namePane = new JPanel();
    Border outBorder= BorderFactory.createLineBorder(StyleConstants.borderColor, 1, true);
    Border inBorder = BorderFactory.createEmptyBorder(5, 10,5,10);
    namePane.setBorder(BorderFactory.createCompoundBorder(outBorder, inBorder));
    namePane.setLayout(new JideBoxLayout(namePane, JideBoxLayout.LINE_AXIS));
    String nameLabel = stringMgr.getString("device.setting.name.label");
    namePane.add(new JLabel(nameLabel), JideBoxLayout.FIX);
    nameField = new JTextField();
    namePane.add(nameField, JideBoxLayout.VARY);
    contentPane.add(namePane, JideBoxLayout.FIX);

    contentPane.add(Box.createVerticalStrut(30), JideBoxLayout.FIX);

    //window panel
    String windowPaneLabel = stringMgr.getString("device.setting.window.label");
    contentPane.add(new JLabel(windowPaneLabel), JideBoxLayout.FIX);
    contentPane.add(createWindowPanel(), JideBoxLayout.FIX);

    contentPane.add(Box.createVerticalStrut(30), JideBoxLayout.FIX);

    //Image quality
    String qualityLabel = stringMgr.getString("device.setting.window.quality.label");
    contentPane.add(new JLabel(qualityLabel), JideBoxLayout.FIX);
    contentPane.add(createImageQualityPanel(), JideBoxLayout.FIX);

    contentPane.add(Box.createVerticalStrut(40), JideBoxLayout.FIX);

    //button panel
    contentPane.add(createButtonPane(), JideBoxLayout.VARY);
}
 
Example #6
Source File: IconButton.java    From CXTouch with GNU General Public License v3.0 5 votes vote down vote up
public IconButton(Icon icon) {
    super(icon);
    setRolloverDecoratedOnly(true);
    Dimension dim = getIconButtonSize();
    if (dim != null) {
        this.setPreferredSize(dim);
    }
    setMargin(1);
    setRound ( StyleConstants.smallRound );
    setShadeWidth ( StyleConstants.shadeWidth );
    setInnerShadeWidth ( StyleConstants.innerShadeWidth );
    setLeftRightSpacing ( 0 );
    setUndecorated ( StyleConstants.undecorated );
    setDrawFocus ( true );
}
 
Example #7
Source File: IconToggleButton.java    From CXTouch with GNU General Public License v3.0 5 votes vote down vote up
public IconToggleButton(Icon icon) {
    super(icon);
    setRolloverDecoratedOnly(true);
    Dimension dim = getIconButtonSize();
    if (dim != null) {
        this.setPreferredSize(dim);
    }
    setMargin(1);
    setRound ( StyleConstants.smallRound );
    setShadeWidth ( StyleConstants.shadeWidth );
    setInnerShadeWidth ( StyleConstants.innerShadeWidth );
    setLeftRightSpacing ( 0 );
    setUndecorated ( StyleConstants.undecorated );
    setDrawFocus ( true );
}
 
Example #8
Source File: CXLookAndFeel.java    From CXTouch with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void initComponentDefaults ( final UIDefaults table )
{
    super.initComponentDefaults(table);
    // list focus border
    final Object listSelectedBorder =
            new SwingLazyValue( "javax.swing.plaf.BorderUIResource.LineBorderUIResource", new Object[]{ StyleConstants.focusColor } );
    table.put ( "List.focusCellHighlightBorder", listSelectedBorder );

    String lang = systemLocale.getLanguage();
    if (lang.equals("zh")) {
        //FileChooser top bar
        table.put("FileChooser.lookInLabelText", "查找");
        table.put("FileChooser.upFolderToolTipText", "向上一级");
        table.put("FileChooser.homeFolderToolTipText", "桌面");
        table.put("FileChooser.newFolderToolTipText", "新建文件夹");
        table.put("FileChooser.listViewButtonToolTipText", "列表");
        table.put("FileChooser.detailsViewButtonToolTipText", "详细信息");
        //FileChooser menu
        table.put("FileChooser.newFolderActionLabelText", "新建文件夹");
        table.put("FileChooser.refreshActionLabelText", "刷新");
        table.put("FileChooser.viewMenuLabelText", "视图");
        table.put("FileChooser.listViewActionLabelText", "列表");
        table.put("FileChooser.detailsViewActionLabelText", "详细信息");
    } else {
        //default value.
        table.put("FileChooser.lookInLabelText", "Find");
        table.put("FileChooser.upFolderToolTipText", "Up Folder");
        table.put("FileChooser.homeFolderToolTipText", "Home Folder");
        table.put("FileChooser.newFolderToolTipText", "New Folder");
        table.put("FileChooser.listViewButtonToolTipText", "List");
        table.put("FileChooser.detailsViewButtonToolTipText", "Details");
        //FileChooser menu
        table.put("FileChooser.newFolderActionLabelText", "New Folder");
        table.put("FileChooser.refreshActionLabelText", "Refresh");
        table.put("FileChooser.viewMenuLabelText", "View");
        table.put("FileChooser.listViewActionLabelText", "List");
        table.put("FileChooser.detailsViewActionLabelText", "Details");
    }
}
 
Example #9
Source File: MyToolBar.java    From JByteMod-Beta with GNU General Public License v2.0 5 votes vote down vote up
protected JButton makeNavigationButton(String action, ImageIcon i, ActionListener a) {
  JButton button = WebButton.createIconWebButton(i, StyleConstants.smallRound, true);
  button.setToolTipText(action);
  button.addActionListener(a);
  button.setFocusable(false);
  button.setBorderPainted(false);
  button.setRolloverEnabled(false);
  return button;
}
 
Example #10
Source File: DeviceSettingDialog.java    From CXTouch with GNU General Public License v3.0 4 votes vote down vote up
private JPanel createImageQualityPanel() {
    JPanel pane = new JPanel();
    pane.setLayout(new JideBoxLayout(pane, JideBoxLayout.Y_AXIS, 5));
    Border outBorder= BorderFactory.createLineBorder(StyleConstants.borderColor, 1, true);
    Border inBorder = BorderFactory.createEmptyBorder(10, 10,10,10);
    pane.setBorder(BorderFactory.createCompoundBorder(outBorder, inBorder));

    //quality
    String qualityLabel = stringMgr.getString("device.setting.image.quality.label");
    pane.add(new JLabel(qualityLabel), JideBoxLayout.FIX);
    qualityField = new JComboBox<>();
    qualityField.addItem(new ItemMeta<>("20", 20));
    qualityField.addItem(new ItemMeta<>("40", 40));
    qualityField.addItem(new ItemMeta<>("60", 60));
    qualityField.addItem(new ItemMeta<>("80", 80));
    qualityField.addItem(new ItemMeta<>("100", 100));
    qualityField.setSelectedIndex(3);
    pane.add(qualityField, JideBoxLayout.FIX);

    pane.add(Box.createVerticalStrut(20), JideBoxLayout.FIX);

    //Zoom rate
    final String zoomRateLabel = stringMgr.getString("device.setting.image.zoomrate.label");
    final JLabel displaySizeLabel = new JLabel(zoomRateLabel);
    pane.add(displaySizeLabel, JideBoxLayout.FIX);
    zoomRateField = new JComboBox<>();
    zoomRateField.addItem(new ItemMeta<>("20%", 0.2f));
    zoomRateField.addItem(new ItemMeta<>("40%", 0.4f));
    zoomRateField.addItem(new ItemMeta<>("50%", 0.5f));
    zoomRateField.addItem(new ItemMeta<>("60%", 0.6f));
    zoomRateField.addItem(new ItemMeta<>("80%", 0.8f));
    zoomRateField.addItem(new ItemMeta<>("100%", 1.0f));
    zoomRateField.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                float zoomRate = (Float) ((ItemMeta)zoomRateField.getSelectedItem()).getValue();
                int width = (int) (connection.getScreenHeight() * zoomRate);
                int height = (int) (connection.getScreenWidth() * zoomRate);
                String text = zoomRateLabel + "(" + width + "x" + height + ")";
                displaySizeLabel.setText(text);
            }
        }
    });
    pane.add(zoomRateField, JideBoxLayout.FIX);

    return pane;
}
 
Example #11
Source File: Notifier.java    From desktopclient-java with GNU General Public License v3.0 4 votes vote down vote up
private void showNotification() {
    final WebDialog dialog = new WebDialog();
    dialog.setUndecorated(true);
    dialog.setBackground(Color.BLACK);
    dialog.setBackground(StyleConstants.transparent);

    WebNotificationPopup popup = new WebNotificationPopup(PopupStyle.dark);
    popup.setIcon(Utils.getIcon("kontalk_small.png"));
    popup.setMargin(View.MARGIN_DEFAULT);
    popup.setDisplayTime(6000);
    popup.addNotificationListener(new NotificationListener() {
        @Override
        public void optionSelected(NotificationOption option) {
        }
        @Override
        public void accepted() {
        }
        @Override
        public void closed() {
            dialog.dispose();
        }
    });

    // content
    WebPanel panel = new WebPanel();
    panel.setMargin(View.MARGIN_DEFAULT);
    panel.setOpaque(false);
    WebLabel title = new WebLabel("A new Message!");
    title.setFontSize(View.FONT_SIZE_BIG);
    title.setForeground(Color.WHITE);
    panel.add(title, BorderLayout.NORTH);
    String text = "this is some message, and some longer text was added";
    WebLabel message = new WebLabel(text);
    message.setForeground(Color.WHITE);
    panel.add(message, BorderLayout.CENTER);
    popup.setContent(panel);

    //popup.packPopup();
    dialog.setSize(popup.getPreferredSize());

    // set position on screen
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gd = ge.getDefaultScreenDevice();
    GraphicsConfiguration gc = gd.getDefaultConfiguration();
    Rectangle screenBounds = gc.getBounds();
    // get height of the task bar
    // doesn't work on all environments
    //Insets toolHeight = toolkit.getScreenInsets(popup.getGraphicsConfiguration());
    int toolHeight  = 40;
    dialog.setLocation(screenBounds.width - dialog.getWidth() - 10,
            screenBounds.height - toolHeight - dialog.getHeight());

    dialog.setVisible(true);
    NotificationManager.showNotification(dialog, popup);
}
 
Example #12
Source File: CXFileUtils.java    From CXTouch with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Returns standart file icon cache key.
 *
 * @param extension    file extension or identifier
 * @param large        whether large icon used or not
 * @param transparency icon transparency
 * @param enabled      whether enabled icon or not
 * @return standart file icon cache key
 */
private static String getStandartFileIconCacheKey ( final String extension, final boolean large, final float transparency,
                                                    final boolean enabled )
{
    return extension + StyleConstants.SEPARATOR + large + StyleConstants.SEPARATOR + transparency + StyleConstants.SEPARATOR + enabled;
}