com.alee.laf.combobox.WebComboBox Java Examples
The following examples show how to use
com.alee.laf.combobox.WebComboBox.
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: GroupPaneExample.java From weblaf with GNU General Public License v3.0 | 6 votes |
@NotNull @Override protected List<? extends JComponent> createPreviewElements () { // First row final WebComboBox e1 = new WebComboBox ( new String[]{ "First", "Second", "Third" } ); final WebButton e2 = new WebButton ( "Second" ); final WebTextField e3 = new WebTextField ( "Third" ); // Second row final WebPanel e4 = new WebPanel ( StyleId.panelDecorated, new WebLabel ( "First", WebLabel.CENTER ) ); final WebTextField e5 = new WebTextField ( "Second" ); final WebButton e6 = new WebButton ( "Third" ); // Third row final WebSpinner e7 = new WebSpinner ( new SpinnerNumberModel ( 100, 0, 100, 1 ) ); final WebButton e8 = new WebButton ( "Second" ); final WebPasswordField e9 = new WebPasswordField ( "Third" ); final GroupPane groupPane = new GroupPane ( getStyleId (), 3, 3, e1, e2, e3, e4, e5, e6, e7, e8, e9 ); SwingUtils.equalizeComponentsWidth ( groupPane.getComponents () ); return CollectionUtils.asList ( groupPane ); }
Example #2
Source File: JToolBarExample.java From weblaf with GNU General Public License v3.0 | 6 votes |
@NotNull @Override protected List<? extends JComponent> createPreviewElements () { final JToolBar toolBar = new JToolBar ( SwingConstants.HORIZONTAL ); toolBar.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () ); toolBar.add ( new WebButton ( getExampleLanguageKey ( "button1" ) ) ); toolBar.add ( new WebButton ( getExampleLanguageKey ( "button2" ) ) ); toolBar.add ( new WebButton ( getExampleLanguageKey ( "button3" ) ) ); toolBar.addSeparator ( new Dimension ( 10, 10 ) ); final WebToggleButton toggle1 = new WebToggleButton ( DemoIcons.win16, SystemUtils.isWindows () ); final WebToggleButton toggle2 = new WebToggleButton ( DemoIcons.mac16, SystemUtils.isMac () ); final WebToggleButton toggle3 = new WebToggleButton ( DemoIcons.unix16, SystemUtils.isUnix () ); final WebToggleButton toggle4 = new WebToggleButton ( DemoIcons.solaris16, SystemUtils.isSolaris () ); toolBar.add ( new GroupPane ( toggle1, toggle2, toggle3, toggle4 ) ); toolBar.addSeparator ( new Dimension ( 10, 10 ) ); toolBar.add ( new WebLabel ( getExampleLanguageKey ( "label1" ) ) ); toolBar.add ( new WebComboBox ( SampleData.createComboBoxModel () ) ); return CollectionUtils.asList ( toolBar ); }
Example #3
Source File: InstructionEditorPanel.java From Cafebabe with GNU General Public License v3.0 | 5 votes |
private void ldcComponentUpdate(WebComboBox wcb, LdcInsnNode ain, Field f, WebTextField field) { switch (wcb.getSelectedIndex()) { case 0: setField(f, ain, field.getText().trim()); break; case 1: setField(f, ain, Integer.parseInt(field.getText().trim())); break; case 2: setField(f, ain, Float.parseFloat(field.getText().trim())); break; case 3: setField(f, ain, Long.parseLong(field.getText().trim())); break; case 4: setField(f, ain, Double.parseDouble(field.getText().trim())); break; case 5: setField(f, ain, Type.getType(field.getText().trim())); break; case 6: setField(f, ain, field.getText().trim()); break; case 7: setField(f, ain, field.getText().trim()); break; } }
Example #4
Source File: DynamicMenu.java From mars-sim with GNU General Public License v3.0 | 5 votes |
public DynamicMenu () { super (); // Custom display event getContentPane ().addMouseListener ( new MouseAdapter () { @Override public void mousePressed ( final MouseEvent e ) { if ( SwingUtils.isMiddleMouseButton ( e ) ) { // Menu with custom elements createMenu ().showMenu ( e.getComponent (), e.getPoint () ); } } } ); setLayout ( new FlowLayout ( FlowLayout.CENTER, 15, 15 ) ); type = new WebComboBox ( DynamicMenuType.values (), DynamicMenuType.shutter ); add ( new GroupPanel ( 5, new WebLabel ( "Display animation:" ), type ) ); hidingType = new WebComboBox ( DynamicMenuType.values (), DynamicMenuType.shutter ); add ( new GroupPanel ( 5, new WebLabel ( "Hide animation:" ), hidingType ) ); radius = new WebTextField ( new IntTextDocument (), "70", 4 ); add ( new GroupPanel ( 5, new WebLabel ( "Menu radius:" ), radius ) ); amount = new WebTextField ( new IntTextDocument (), "5", 4 ); add ( new GroupPanel ( 5, new WebLabel ( "Items amount:" ), amount ) ); setDefaultCloseOperation ( WindowConstants.EXIT_ON_CLOSE ); setSize ( 800, 600 ); setLocationRelativeTo ( null ); setVisible ( true ); }
Example #5
Source File: WebComboBoxExample.java From weblaf with GNU General Public License v3.0 | 5 votes |
@NotNull @Override protected List<? extends JComponent> createPreviewElements () { final WebComboBox simple = new WebComboBox ( getStyleId (), createData () ); final WebComboBox editable = new WebComboBox ( getStyleId (), createData () ); editable.setEditable ( true ); return CollectionUtils.asList ( simple, editable ); }
Example #6
Source File: GroupPaneExample.java From weblaf with GNU General Public License v3.0 | 5 votes |
@NotNull @Override protected List<? extends JComponent> createPreviewElements () { final WebButton e1 = new WebButton ( "First" ); final WebComboBox e2 = new WebComboBox ( new String[]{ "First", "Second", "Third" }, 1 ); final WebTextField e3 = new WebTextField ( "Third" ); final WebButton e4 = new WebButton ( "Last" ); final GroupPane groupPane = new GroupPane ( getStyleId (), e1, e2, e3, e4 ); SwingUtils.equalizeComponentsWidth ( groupPane.getComponents () ); return CollectionUtils.asList ( groupPane ); }
Example #7
Source File: SkinChooserTool.java From weblaf with GNU General Public License v3.0 | 5 votes |
/** * Constructs new {@link SkinChooserTool}. */ public SkinChooserTool () { super ( StyleId.panelTransparent, new BorderLayout ( 0, 0 ) ); // Skin chooser combobox final WebComboBox chooser = new WebComboBox ( DemoStyles.toolCombobox, DemoApplication.skins ); chooser.setLanguage ( "demo.tool.skin" ); chooser.setSelectedItem ( StyleManager.getSkin () ); chooser.setRenderer ( new WebComboBoxRenderer<Skin, JList, ComboBoxCellParameters<Skin, JList>> () { @Override protected Icon iconForValue ( @NotNull final ComboBoxCellParameters<Skin, JList> parameters ) { return parameters.index () == -1 ? DemoIcons.brush16 : parameters.value ().getIcon (); } } ); chooser.addActionListener ( new ActionListener () { @Override public void actionPerformed ( @NotNull final ActionEvent e ) { // Executing later to allow combobox popup to close first CoreSwingUtils.invokeLater ( new Runnable () { @Override public void run () { final Skin skin = ( Skin ) chooser.getSelectedItem (); if ( skin != null ) { StyleManager.setSkin ( skin ); } } } ); } } ); add ( chooser, BorderLayout.CENTER ); }
Example #8
Source File: SettlementTransparentPanel.java From mars-sim with GNU General Public License v3.0 | 4 votes |
public WebComboBox getSettlementListBox() { return settlementListBox; }
Example #9
Source File: ConfigurationDialog.java From desktopclient-java with GNU General Public License v3.0 | 4 votes |
NetworkPanel() { GroupPanel groupPanel = new GroupPanel(View.GAP_DEFAULT, false); groupPanel.setMargin(View.MARGIN_BIG); groupPanel.add(new WebLabel(Tr.tr("Network Settings")).setBoldFont()); groupPanel.add(new WebSeparator(true, true)); mConnectStartupBox = createCheckBox(Tr.tr("Connect on startup"), "", mConf.getBoolean(Config.MAIN_CONNECT_STARTUP)); groupPanel.add(mConnectStartupBox); mConnectRetryBox = createCheckBox(Tr.tr("Retry on connection failure"), Tr.tr("Try automatic (re-)connect after connection failure"), mConf.getBoolean(Config.NET_RETRY_CONNECT)); groupPanel.add(new GroupPanel(mConnectRetryBox, new WebSeparator())); mRequestAvatars = createCheckBox(Tr.tr("Download profile pictures"), Tr.tr("Download the profile pictures of your contacts"), mConf.getBoolean(Config.NET_REQUEST_AVATARS)); groupPanel.add(new GroupPanel(mRequestAvatars, new WebSeparator())); mImgResizeMap = new LinkedHashMap<>(); mImgResizeMap.put(-1, Tr.tr("Original")); mImgResizeMap.put(300 * 1000, Tr.tr("Small (0.3MP)")); mImgResizeMap.put(500 * 1000, Tr.tr("Medium (0.5MP)")); mImgResizeMap.put(800 * 1000, Tr.tr("Large (0.8MP)")); mMaxImgSizeBox = new WebComboBox(new ArrayList<>(mImgResizeMap.values()).toArray()); int maxImgIndex = new ArrayList<>(mImgResizeMap.keySet()).indexOf( mConf.getInt(Config.NET_MAX_IMG_SIZE)); if (maxImgIndex >= 0) mMaxImgSizeBox.setSelectedIndex(maxImgIndex); TooltipManager.addTooltip(mMaxImgSizeBox, Tr.tr("Reduce size of images before sending")); groupPanel.add(new GroupPanel(View.GAP_DEFAULT, new WebLabel(Tr.tr("Resize image attachments:")), mMaxImgSizeBox, new WebSeparator())); this.add(groupPanel); }
Example #10
Source File: ConfigurationDialog.java From desktopclient-java with GNU General Public License v3.0 | 4 votes |
ViewPanel() { GroupPanel groupPanel = new GroupPanel(View.GAP_DEFAULT, false); groupPanel.setMargin(View.MARGIN_BIG); groupPanel.add(new WebLabel(Tr.tr("View Settings")).setBoldFont()); groupPanel.add(new WebSeparator(true, true)); String bgPath = mConf.getString(Config.VIEW_CHAT_BG); mBGBox = createCheckBox(Tr.tr("Custom background:")+" ", "", !bgPath.isEmpty()); mBGBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { mBGChooser.setEnabled(e.getStateChange() == ItemEvent.SELECTED); mBGChooser.getChooseButton().setEnabled(e.getStateChange() == ItemEvent.SELECTED); } }); TooltipManager.addTooltip(mBGBox, Tr.tr("Background image for all chats")); mBGChooser = Utils.createImageChooser(bgPath); mBGChooser.setEnabled(mBGBox.isSelected()); groupPanel.add(new GroupPanel(GroupingType.fillLast, mBGBox, mBGChooser)); mMessageFontSizeMap = new LinkedHashMap<>(); mMessageFontSizeMap.put(Tr.tr("Small"), 1); mMessageFontSizeMap.put(Tr.tr("Normal"), -1); mMessageFontSizeMap.put(Tr.tr("Large"), 2); mMessageFontSizeMap.put(Tr.tr("Huge"), 3); mMessageFontSizeBox = new WebComboBox(new ArrayList<>(mMessageFontSizeMap.keySet()).toArray()); int fontSizeIndex = new ArrayList<>(mMessageFontSizeMap.values()).indexOf( mConf.getInt(Config.VIEW_MESSAGE_FONT_SIZE)); if (fontSizeIndex >= 0) mMessageFontSizeBox.setSelectedIndex(fontSizeIndex); TooltipManager.addTooltip(mMessageFontSizeBox, Tr.tr("Font size for message text and date")); groupPanel.add(new GroupPanel(View.GAP_DEFAULT, new WebLabel(Tr.tr("Font size for chat messages:")), mMessageFontSizeBox, new WebSeparator())); this.add(groupPanel); }
Example #11
Source File: WebTreeCellEditor.java From weblaf with GNU General Public License v3.0 | 2 votes |
/** * Constructs tree cell editor with a specified combo box as editor. * * @param comboBox editor combobox */ public WebTreeCellEditor ( final WebComboBox comboBox ) { super ( comboBox ); }