List of usage examples for javax.swing ButtonGroup add
public void add(AbstractButton b)
From source file:unikn.dbis.univis.explorer.VExplorer.java
License:asdf
private void makeLanguageMenu() { german.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Locale locale = Locale.GERMAN; MessageResolver.setLocale(locale); whatLanguageLabel.setText(locale.getDisplayName(locale)); ComponentUtilities.repaintComponentTree(VExplorer.this); }/*from w w w .j a v a2s. co m*/ }); english.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Locale locale = Locale.ENGLISH; MessageResolver.setLocale(locale); whatLanguageLabel.setText(locale.getDisplayName(locale)); ComponentUtilities.repaintComponentTree(VExplorer.this); } }); newLanguage.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(VExplorer.this.getContentPane(), languageMessage, languageTitle, 1); } }); final ButtonGroup languageGroup = new ButtonGroup(); german.setSelected(true); languageGroup.add(german); languageGroup.add(english); languageMenu.add(german); languageMenu.add(english); languageMenu.add(newLanguage); }
From source file:us.daveread.basicquery.BasicQuery.java
/** * Builds the GUI for the application/*from ww w. jav a 2s. co m*/ */ private void setup() { JPanel panel; JPanel gridPanel; JPanel outerPanel; JPanel flowPanel; JPanel boxedPanel; ButtonGroup bGroup; MaxHeightJScrollPane maxHeightJScrollPane; setupComponents(); getContentPane().setLayout(new BorderLayout()); // table.getTableHeader().setFont(new Font(table.getTableHeader().getFont(). // getName(), table.getTableHeader().getFont().getStyle(), // MessageStyleFactory.instance().getFontSize())); getContentPane().add(new JScrollPane(table), BorderLayout.CENTER); panel = new JPanel(); panel.setLayout(new BorderLayout()); outerPanel = new JPanel(); outerPanel.setLayout(new BorderLayout()); gridPanel = new JPanel(); gridPanel.setLayout(new GridLayout(0, 1)); gridPanel.add(connectString = new JComboBox()); connectString.setEditable(true); gridPanel.add(querySelection = new JComboBox()); querySelection.setEditable(false); querySelection.addActionListener(this); outerPanel.add(gridPanel, BorderLayout.NORTH); outerPanel.add(new JScrollPane(queryText = new JTextArea(QUERY_AREA_ROWS, QUERY_AREA_COLUMNS)), BorderLayout.SOUTH); queryText.setLineWrap(true); queryText.setWrapStyleWord(true); queryText.addKeyListener(this); panel.add(outerPanel, BorderLayout.CENTER); outerPanel = new JPanel(); outerPanel.setLayout(new BorderLayout()); boxedPanel = new JPanel(); boxedPanel.setLayout(new GridLayout(0, 2)); boxedPanel.add(new JLabel(Resources.getString("proUserId"))); boxedPanel.add(userId = new JTextField(10)); boxedPanel.add(new JLabel(Resources.getString("proPassword"))); boxedPanel.add(password = new JPasswordField(10)); outerPanel.add(boxedPanel, BorderLayout.WEST); // Prev/Next and the checkboxes are all on the flowPanel - Center of // outerPanel flowPanel = new JPanel(); flowPanel.setLayout(new FlowLayout(FlowLayout.CENTER)); // Previous/Next buttons boxedPanel = new JPanel(); boxedPanel.setLayout(new FlowLayout()); boxedPanel.add(previousQuery = new JButton(Resources.getString("ctlPrev"), new ImageIcon(ImageUtility.getImageAsByteArray("ArrowLeftGreen.gif")))); previousQuery.setToolTipText(Resources.getString("tipPrev")); previousQuery.addActionListener(this); boxedPanel.add(nextQuery = new JButton(Resources.getString("ctlNext"), new ImageIcon(ImageUtility.getImageAsByteArray("ArrowRightGreen.gif")))); nextQuery.setToolTipText(Resources.getString("tipNext")); nextQuery.addActionListener(this); flowPanel.add(boxedPanel); // Checkboxes: Autocommit, Read Only and Pooling boxedPanel = new JPanel(); boxedPanel.setLayout(new FlowLayout()); boxedPanel.setBorder(getStandardBorder()); boxedPanel.add(autoCommit = new JCheckBox(Resources.getString("ctlAutoCommit"), true)); boxedPanel.add(readOnly = new JCheckBox(Resources.getString("ctlReadOnly"), false)); boxedPanel.add(poolConnect = new JCheckBox(Resources.getString("ctlConnPool"), false)); poolConnect.setEnabled(false); flowPanel.add(boxedPanel); outerPanel.add(flowPanel, BorderLayout.CENTER); boxedPanel = new JPanel(); boxedPanel.setLayout(new GridLayout(0, 1)); boxedPanel.setBorder(getStandardBorder()); boxedPanel.add(runIndicator = new JLabel(Resources.getString("ctlRunning"), JLabel.CENTER)); runIndicator.setForeground(Color.lightGray); boxedPanel.add(timeIndicator = new JLabel("", JLabel.RIGHT)); outerPanel.add(boxedPanel, BorderLayout.EAST); panel.add(outerPanel, BorderLayout.NORTH); flowPanel = new JPanel(); flowPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); boxedPanel = new JPanel(); boxedPanel.setLayout(new FlowLayout()); boxedPanel.setBorder(getStandardBorder()); boxedPanel.add(new JLabel(Resources.getString("proQueryType"))); boxedPanel.add(asQuery = new JRadioButton(Resources.getString("ctlSelect"), true)); boxedPanel.add(asUpdate = new JRadioButton(Resources.getString("ctlUpdate"))); boxedPanel.add(asDescribe = new JRadioButton(Resources.getString("ctlDescribe"))); bGroup = new ButtonGroup(); bGroup.add(asQuery); bGroup.add(asUpdate); bGroup.add(asDescribe); asQuery.addActionListener(this); asUpdate.addActionListener(this); asDescribe.addActionListener(this); flowPanel.add(boxedPanel); flowPanel.add(new JLabel(" ")); boxedPanel = new JPanel(); boxedPanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); boxedPanel.setBorder(getStandardBorder()); boxedPanel.add(new JLabel(Resources.getString("proMaxRows"))); boxedPanel.add(maxRows); flowPanel.add(boxedPanel); flowPanel.add(new JLabel(" ")); flowPanel.add(execute = new JButton(Resources.getString("ctlExecute"))); execute.addActionListener(this); flowPanel.add(remove = new JButton(Resources.getString("ctlRemove"))); remove.addActionListener(this); flowPanel.add(commentToggle = new JButton(Resources.getString("ctlComment"))); commentToggle.addActionListener(this); flowPanel.add(nextInList = new JButton(Resources.getString("ctlDown"))); nextInList.addActionListener(this); panel.add(flowPanel, BorderLayout.SOUTH); getContentPane().add(panel, BorderLayout.NORTH); getRootPane().setDefaultButton(execute); messageDocument = new DefaultStyledDocument(); getContentPane().add( maxHeightJScrollPane = new MaxHeightJScrollPane(message = new JTextPane(messageDocument)), BorderLayout.SOUTH); message.setEditable(false); loadedDBDriver = false; loadMenu(); setupTextStyles(); loadProperties(); setupUserDefinedColoring(); setupResultsTableColoring(); loadConfig(); loadConnectStrings(); loadQueries(); loadDrivers(); // Check for avail of pool - enable/disable pooling option as appropriate // Not really useful until we get the pooling classes out of this code try { new GenericObjectPool(null); poolConnect.setEnabled(true); poolConnect.setSelected(true); } catch (Throwable any) { // No Apache Commons DB Pooling Library Found (DBCP) LOGGER.error(Resources.getString("errNoPoolLib"), any); } setDefaults(); maxHeightJScrollPane.lockHeight(getHeight() / MAX_SCROLL_PANE_DIVISOR_FOR_MAX_HEIGHT); // Font setFontFromConfig(Configuration.instance()); setVisible(true); }
From source file:us.daveread.basicquery.BasicQuery.java
/** * Language selection menu/*from ww w .j a v a2 s . c o m*/ * * @return The language selection menu */ private JMenu languageMenu() { JMenu subMenu; ButtonGroup buttonGroup; // Setup | Language subMenu = new JMenu(Resources.getString("mnuSetupLanguageLabel")); subMenu.setMnemonic(Resources.getChar("mnuSetupLanguageAccel")); subMenu.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuSetupLanguageDesc")); // Setup | Language | System Default if (System.getProperty(PROP_SYSTEM_DEFAULTLANGUAGE) != null) { if (System.getProperty(PROP_SYSTEM_DEFAULTCOUNTRY) != null) { configLanguageDefault = new JRadioButtonMenuItem(Resources.getString("mnuSetupLanguageDefaultLabel") + " (" + System.getProperty(PROP_SYSTEM_DEFAULTLANGUAGE) + "_" + System.getProperty(PROP_SYSTEM_DEFAULTCOUNTRY) + ")"); } else { configLanguageDefault = new JRadioButtonMenuItem(Resources.getString("mnuSetupLanguageDefaultLabel") + " (" + System.getProperty(PROP_SYSTEM_DEFAULTLANGUAGE) + ")"); } } else { configLanguageDefault = new JRadioButtonMenuItem(Resources.getString("mnuSetupLanguageDefaultLabel")); } configLanguageDefault.setMnemonic(Resources.getChar("mnuSetupLanguageDefaultAccel")); configLanguageDefault.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupLanguageDefaultDesc")); configLanguageDefault.addActionListener(this); subMenu.add(configLanguageDefault); // Setup | Language | Deutsche (German) configLanguageGerman = new JRadioButtonMenuItem(Resources.getString("mnuSetupLanguageGermanLabel")); configLanguageGerman.setMnemonic(Resources.getChar("mnuSetupLanguageGermanAccel")); configLanguageGerman.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupLanguageGermanDesc")); configLanguageGerman.addActionListener(this); subMenu.add(configLanguageGerman); // Setup | Language | English configLanguageEnglish = new JRadioButtonMenuItem(Resources.getString("mnuSetupLanguageEnglishLabel")); configLanguageEnglish.setMnemonic(Resources.getChar("mnuSetupLanguageEnglishAccel")); configLanguageEnglish.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupLanguageEnglishDesc")); configLanguageEnglish.addActionListener(this); subMenu.add(configLanguageEnglish); // Setup | Language | Espanola (Spanish) configLanguageSpanish = new JRadioButtonMenuItem(Resources.getString("mnuSetupLanguageSpanishLabel")); configLanguageSpanish.setMnemonic(Resources.getChar("mnuSetupLanguageSpanishAccel")); configLanguageSpanish.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupLanguageSpanishDesc")); configLanguageSpanish.addActionListener(this); subMenu.add(configLanguageSpanish); // Setup | Language | Francaise (French) configLanguageFrench = new JRadioButtonMenuItem(Resources.getString("mnuSetupLanguageFrenchLabel")); configLanguageFrench.setMnemonic(Resources.getChar("mnuSetupLanguageFrenchAccel")); configLanguageFrench.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupLanguageFrenchDesc")); configLanguageFrench.addActionListener(this); subMenu.add(configLanguageFrench); // Setup | Language | Italiana (Italian) configLanguageItalian = new JRadioButtonMenuItem(Resources.getString("mnuSetupLanguageItalianLabel")); configLanguageItalian.setMnemonic(Resources.getChar("mnuSetupLanguageItalianAccel")); configLanguageItalian.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupLanguageItalianDesc")); configLanguageItalian.addActionListener(this); subMenu.add(configLanguageItalian); // Setup | Language | Portugues (Portuguese) configLanguagePortuguese = new JRadioButtonMenuItem(Resources.getString("mnuSetupLanguagePortugueseLabel")); configLanguagePortuguese.setMnemonic(Resources.getChar("mnuSetupLanguagePortugueseAccel")); configLanguagePortuguese.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupLanguagePortugueseDesc")); configLanguagePortuguese.addActionListener(this); subMenu.add(configLanguagePortuguese); buttonGroup = new ButtonGroup(); buttonGroup.add(configLanguageDefault); buttonGroup.add(configLanguageEnglish); buttonGroup.add(configLanguageFrench); buttonGroup.add(configLanguageGerman); buttonGroup.add(configLanguageItalian); buttonGroup.add(configLanguagePortuguese); buttonGroup.add(configLanguageSpanish); return subMenu; }
From source file:us.daveread.basicquery.BasicQuery.java
/** * Configuration menu setup/*from w ww. java2 s. c o m*/ * * @return The configuration menu */ private JMenu configurationMenu() { JMenu menu; JMenu subMenu; ButtonGroup buttonGroup; // Configuration Menu menu = new JMenu(Resources.getString("mnuSetupLabel")); menu.setMnemonic(Resources.getChar("mnuSetupAccel")); menu.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuSetupDesc")); menu.add(languageMenu()); // Setup | Font configFont = new JMenuItem(Resources.getString("mnuConfigFontLabel")); configFont.setMnemonic(Resources.getChar("mnuConfigFontAccel")); configFont.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuConfigFontDesc")); configFont.addActionListener(this); configFont.setEnabled(true); menu.add(configFont); // Setup | Display DB Server Info subMenu = new JMenu(Resources.getString("mnuSetupDBServerLabel")); subMenu.setMnemonic(Resources.getChar("mnuSetupDBServerAccel")); subMenu.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuSetupDBServerDesc")); menu.add(subMenu); // Configuration | Display DB Server Info | None configDisplayDBServerInfoNone = new JRadioButtonMenuItem(Resources.getString("mnuSetupDBServerNoneLabel")); configDisplayDBServerInfoNone.setMnemonic(Resources.getChar("mnuSetupDBServerNoneAccel")); configDisplayDBServerInfoNone.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupDBServerNoneDesc")); subMenu.add(configDisplayDBServerInfoNone); // Configuration | Display DB Server Info | Brief configDisplayDBServerInfoShort = new JRadioButtonMenuItem( Resources.getString("mnuSetupDBServerBriefLabel")); configDisplayDBServerInfoShort.setMnemonic(Resources.getChar("mnuSetupDBServerBriefAccel")); configDisplayDBServerInfoShort.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupDBServerBriefDesc")); subMenu.add(configDisplayDBServerInfoShort); // Configuration | Display DB Server Info | Long configDisplayDBServerInfoLong = new JRadioButtonMenuItem(Resources.getString("mnuSetupDBServerLongLabel")); configDisplayDBServerInfoLong.setMnemonic(Resources.getChar("mnuSetupDBServerLongAccel")); configDisplayDBServerInfoLong.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupDBServerLongDesc")); subMenu.add(configDisplayDBServerInfoLong); buttonGroup = new ButtonGroup(); buttonGroup.add(configDisplayDBServerInfoNone); buttonGroup.add(configDisplayDBServerInfoLong); buttonGroup.add(configDisplayDBServerInfoShort); // Default is short display of DB server info configDisplayDBServerInfoShort.setSelected(true); // Setup | Table Row Coloring subMenu = new JMenu(Resources.getString("mnuSetupRowColorLabel")); subMenu.setMnemonic(Resources.getChar("mnuSetupRowColorAccel")); subMenu.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuSetupRowColorDesc")); menu.add(subMenu); // Setup | Table Row Coloring | None configTableColoringNone = new JRadioButtonMenuItem(Resources.getString("mnuSetupRowColorNoneLabel")); configTableColoringNone.setMnemonic(Resources.getChar("mnuSetupRowColorNoneAccel")); configTableColoringNone.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupRowColorNoneDesc")); configTableColoringNone.addActionListener(this); subMenu.add(configTableColoringNone); // Setup | Table Row Coloring | Green Bar configTableColoringGreenBar = new JRadioButtonMenuItem( Resources.getString("mnuSetupRowColorGreenBarLabel")); configTableColoringGreenBar.setMnemonic(Resources.getChar("mnuSetupRowColorGreenBarAccel")); configTableColoringGreenBar.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupRowColorGreenBarDesc")); configTableColoringGreenBar.addActionListener(this); subMenu.add(configTableColoringGreenBar); // Setup | Table Row Coloring | Yellow Bar configTableColoringYellowBar = new JRadioButtonMenuItem( Resources.getString("mnuSetupRowColorYellowBarLabel")); configTableColoringYellowBar.setMnemonic(Resources.getChar("mnuSetupRowColorYellowBarAccel")); configTableColoringYellowBar.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupRowColorYellowBarDesc")); configTableColoringYellowBar.addActionListener(this); subMenu.add(configTableColoringYellowBar); subMenu.addSeparator(); // Setup | Table Row Coloring | User Defined configTableColoringUserDefined = new JRadioButtonMenuItem( Resources.getString("mnuSetupRowColorUserDefLabel")); configTableColoringUserDefined.setMnemonic(Resources.getChar("mnuSetupRowColorUserDefAccel")); configTableColoringUserDefined.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupRowColorUserDefDesc")); configTableColoringUserDefined.addActionListener(this); subMenu.add(configTableColoringUserDefined); buttonGroup = new ButtonGroup(); buttonGroup.add(configTableColoringNone); buttonGroup.add(configTableColoringGreenBar); buttonGroup.add(configTableColoringYellowBar); buttonGroup.add(configTableColoringUserDefined); // Default is no special coloring of data rows configTableColoringNone.setSelected(true); menu.addSeparator(); // Configuration | Associate SQL and Connect URL configHistoryAssocSQLAndConnect = new JCheckBoxMenuItem(Resources.getString("mnuSetupAssocSQLURLLabel")); configHistoryAssocSQLAndConnect.setMnemonic(Resources.getChar("mnuSetupAssocSQLURLAccel")); configHistoryAssocSQLAndConnect.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupAssocSQLURLDesc")); configHistoryAssocSQLAndConnect.setEnabled(true); menu.add(configHistoryAssocSQLAndConnect); // Configuration | Parse SQL at Semi-Colons configParseSemicolons = new JCheckBoxMenuItem(Resources.getString("mnuSetupParseSQLSemicolonLabel")); configParseSemicolons.setMnemonic(Resources.getChar("mnuSetupParseSQLSemicolonAccel")); configParseSemicolons.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupParseSQLSemicolonDesc")); configParseSemicolons.setEnabled(true); menu.add(configParseSemicolons); menu.addSeparator(); // Configuration | Display Column Data Type configDisplayColumnDataType = new JCheckBoxMenuItem(Resources.getString("mnuSetupDispColTypeLabel")); configDisplayColumnDataType.setMnemonic(Resources.getChar("mnuSetupDispColTypeAccel")); configDisplayColumnDataType.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupDispColTypeDesc")); configDisplayColumnDataType.setEnabled(true); configDisplayColumnDataType.setSelected(false); menu.add(configDisplayColumnDataType); // Configuration | Display Client Info configDisplayClientInfo = new JCheckBoxMenuItem(Resources.getString("mnuSetupClientInfoLabel")); configDisplayClientInfo.setMnemonic(Resources.getChar("mnuSetupClientInfoAccel")); configDisplayClientInfo.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupClientInfoDesc")); configDisplayClientInfo.setEnabled(true); configDisplayClientInfo.setSelected(false); menu.add(configDisplayClientInfo); menu.addSeparator(); // Configuration | Save Password configSavePassword = new JCheckBoxMenuItem(Resources.getString("mnuSetupSavePasswordLabel")); configSavePassword.setMnemonic(Resources.getChar("mnuSetupSavePasswordAccel")); configSavePassword.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupSavePasswordDesc")); configSavePassword.setEnabled(true); configSavePassword.setSelected(false); menu.add(configSavePassword); return menu; }
From source file:us.paulevans.basicxslt.TransformOutputPropertiesFrame.java
/** * Builds the method panel//w ww .jav a 2s . com * @return */ private JPanel buildMethodPanel() { int row; ButtonGroup group; GridBagLayout layout; GridBagConstraints constraints; JPanel panel; row = 0; group = new ButtonGroup(); layout = new GridBagLayout(); constraints = new GridBagConstraints(); panel = new JPanel(layout); GUIUtils.add(panel, xml = new JRadioButton( stringFactory.getString(LabelStringFactory.OUTPUTPROPS_FRAME_METHODS_XML) + " | "), layout, constraints, row, 0, 1, 1, GridBagConstraints.WEST, GridBagConstraints.NONE, GUIUtils.NO_INSETS); GUIUtils.add(panel, html = new JRadioButton( stringFactory.getString(LabelStringFactory.OUTPUTPROPS_FRAME_METHODS_HTML) + " | "), layout, constraints, row, 1, 1, 1, GridBagConstraints.WEST, GridBagConstraints.NONE, GUIUtils.NO_INSETS); GUIUtils.add(panel, text = new JRadioButton( stringFactory.getString(LabelStringFactory.OUTPUTPROPS_FRAME_METHODS_TEXT) + " | "), layout, constraints, row, 2, 1, 1, GridBagConstraints.WEST, GridBagConstraints.NONE, GUIUtils.NO_INSETS); GUIUtils.add(panel, other = new JRadioButton( stringFactory.getString(LabelStringFactory.OUTPUTPROPS_FRAME_METHODS_OTHER)), layout, constraints, row, 3, 1, 1, GridBagConstraints.WEST, GridBagConstraints.NONE, GUIUtils.NO_INSETS); GUIUtils.add(panel, otherMethod = new JTextField(10), layout, constraints, row, 4, 1, 1, GridBagConstraints.WEST, GridBagConstraints.NONE, GUIUtils.NO_INSETS); group.add(xml); group.add(html); group.add(text); group.add(other); xml.addActionListener(this); html.addActionListener(this); text.addActionListener(this); other.addActionListener(this); xml.setSelected(true); otherMethod.setEnabled(false); otherMethod.setBackground(Color.LIGHT_GRAY); return panel; }
From source file:utybo.branchingstorytree.swing.OpenBSTGUI.java
private JMenu createShortMenu() { JMenu shortMenu = new JMenu(); addDarkModeCallback(b -> {/*w w w. j a v a2s .c om*/ shortMenu.setBackground(b ? OPENBST_BLUE.darker().darker() : OPENBST_BLUE.brighter()); shortMenu.setForeground(b ? Color.WHITE : OPENBST_BLUE); }); shortMenu.setBackground(OPENBST_BLUE.brighter()); shortMenu.setForeground(OPENBST_BLUE); shortMenu.setText(Lang.get("banner.title")); shortMenu.setIcon(new ImageIcon(Icons.getImage("Logo", 16))); JMenuItem label = new JMenuItem(Lang.get("menu.title")); label.setEnabled(false); shortMenu.add(label); shortMenu.addSeparator(); shortMenu.add( new JMenuItem(new AbstractAction(Lang.get("menu.open"), new ImageIcon(Icons.getImage("Open", 16))) { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { openStory(VisualsUtils.askForFile(OpenBSTGUI.this, Lang.get("file.title"))); } })); shortMenu.addSeparator(); shortMenu.add(new JMenuItem( new AbstractAction(Lang.get("menu.create"), new ImageIcon(Icons.getImage("Add Property", 16))) { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { doNewEditor(); } })); JMenu additionalMenu = new JMenu(Lang.get("menu.advanced")); shortMenu.add(additionalMenu); additionalMenu.add(new JMenuItem( new AbstractAction(Lang.get("menu.package"), new ImageIcon(Icons.getImage("Open Archive", 16))) { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { new PackageDialog(instance).setVisible(true); } })); additionalMenu.add(new JMenuItem( new AbstractAction(Lang.get("langcheck"), new ImageIcon(Icons.getImage("LangCheck", 16))) { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { final Map<String, String> languages = new Gson() .fromJson(new InputStreamReader( OpenBST.class.getResourceAsStream( "/utybo/branchingstorytree/swing/lang/langs.json"), StandardCharsets.UTF_8), new TypeToken<Map<String, String>>() { }.getType()); languages.remove("en"); languages.remove("default"); JComboBox<String> jcb = new JComboBox<>(new Vector<>(languages.keySet())); JPanel panel = new JPanel(); panel.add(new JLabel(Lang.get("langcheck.choose"))); panel.add(jcb); int result = JOptionPane.showOptionDialog(OpenBSTGUI.this, panel, Lang.get("langcheck"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null); if (result == JOptionPane.OK_OPTION) { Locale selected = new Locale((String) jcb.getSelectedItem()); if (!Lang.getMap().keySet().contains(selected)) { try { Lang.loadTranslationsFromFile(selected, OpenBST.class .getResourceAsStream("/utybo/branchingstorytree/swing/lang/" + languages.get(jcb.getSelectedItem().toString()))); } catch (UnrespectedModelException | IOException e1) { LOG.warn("Failed to load translation file", e1); } } ArrayList<String> list = new ArrayList<>(); Lang.getLocaleMap(Locale.ENGLISH).forEach((k, v) -> { if (!Lang.getLocaleMap(selected).containsKey(k)) { list.add(k + "\n"); } }); StringBuilder sb = new StringBuilder(); Collections.sort(list); list.forEach(s -> sb.append(s)); JDialog dialog = new JDialog(OpenBSTGUI.this, Lang.get("langcheck")); dialog.getContentPane().setLayout(new MigLayout()); dialog.getContentPane().add(new JLabel(Lang.get("langcheck.result")), "pushx, growx, wrap"); JTextArea area = new JTextArea(); area.setLineWrap(true); area.setWrapStyleWord(true); area.setText(sb.toString()); area.setEditable(false); area.setBorder(BorderFactory.createLoweredBevelBorder()); JScrollPane jsp = new JScrollPane(area); jsp.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); dialog.getContentPane().add(jsp, "pushx, pushy, growx, growy"); dialog.setSize((int) (Icons.getScale() * 300), (int) (Icons.getScale() * 300)); dialog.setLocationRelativeTo(OpenBSTGUI.this); dialog.setModalityType(ModalityType.APPLICATION_MODAL); dialog.setVisible(true); } } })); additionalMenu.add(new JMenuItem( new AbstractAction(Lang.get("menu.debug"), new ImageIcon(Icons.getImage("Code", 16))) { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { DebugInfo.launch(OpenBSTGUI.this); } })); JMenu includedFiles = new JMenu("Included BST files"); for (Entry<String, String> entry : OpenBST.getInternalFiles().entrySet()) { JMenuItem jmi = new JMenuItem(entry.getKey()); jmi.addActionListener(ev -> { String path = "/bst/" + entry.getValue(); InputStream is = OpenBSTGUI.class.getResourceAsStream(path); ProgressMonitorInputStream pmis = new ProgressMonitorInputStream(OpenBSTGUI.this, "Extracting...", is); new Thread(() -> { try { File f = File.createTempFile("openbstinternal", ".bsp"); FileOutputStream fos = new FileOutputStream(f); IOUtils.copy(pmis, fos); openStory(f); } catch (final IOException e) { LOG.error("IOException caught", e); showException(Lang.get("file.error").replace("$e", e.getClass().getSimpleName()) .replace("$m", e.getMessage()), e); } }).start(); }); includedFiles.add(jmi); } additionalMenu.add(includedFiles); shortMenu.addSeparator(); JMenu themesMenu = new JMenu(Lang.get("menu.themes")); shortMenu.add(themesMenu); themesMenu.setIcon(new ImageIcon(Icons.getImage("Color Wheel", 16))); ButtonGroup themesGroup = new ButtonGroup(); JRadioButtonMenuItem jrbmi; jrbmi = new JRadioButtonMenuItem(Lang.get("menu.themes.dark")); if (0 == selectedTheme) { jrbmi.setSelected(true); } jrbmi.addActionListener(e -> switchLaF(0, DARK_THEME)); themesMenu.add(jrbmi); themesGroup.add(jrbmi); jrbmi = new JRadioButtonMenuItem(Lang.get("menu.themes.light")); if (1 == selectedTheme) { jrbmi.setSelected(true); } jrbmi.addActionListener(e -> switchLaF(1, LIGHT_THEME)); themesMenu.add(jrbmi); themesGroup.add(jrbmi); jrbmi = new JRadioButtonMenuItem(Lang.get("menu.themes.debug")); if (2 == selectedTheme) { jrbmi.setSelected(true); } jrbmi.addActionListener(e -> switchLaF(2, DEBUG_THEME)); themesMenu.add(jrbmi); themesGroup.add(jrbmi); JMenu additionalLightThemesMenu = new JMenu(Lang.get("menu.themes.morelight")); int j = 3; for (Map.Entry<String, LookAndFeel> entry : ADDITIONAL_LIGHT_THEMES.entrySet()) { int jf = j; jrbmi = new JRadioButtonMenuItem(entry.getKey()); if (j == selectedTheme) jrbmi.setSelected(true); jrbmi.addActionListener(e -> switchLaF(jf, entry.getValue())); additionalLightThemesMenu.add(jrbmi); themesGroup.add(jrbmi); j++; } themesMenu.add(additionalLightThemesMenu); JMenu additionalDarkThemesMenu = new JMenu(Lang.get("menu.themes.moredark")); for (Map.Entry<String, LookAndFeel> entry : ADDITIONAL_DARK_THEMES.entrySet()) { int jf = j; jrbmi = new JRadioButtonMenuItem(entry.getKey()); if (j == selectedTheme) jrbmi.setSelected(true); jrbmi.addActionListener(e -> switchLaF(jf, entry.getValue())); additionalDarkThemesMenu.add(jrbmi); themesGroup.add(jrbmi); j++; } themesMenu.add(additionalDarkThemesMenu); shortMenu.add(new JMenuItem( new AbstractAction(Lang.get("menu.about"), new ImageIcon(Icons.getImage("About", 16))) { /** * */ private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { new AboutDialog(instance).setVisible(true); } })); return shortMenu; }
From source file:verdandi.ui.settings.DefaultSettingsPanel.java
private JPanel getTimeFormatSettingsPanel() { JPanel res = new JPanel(); res.setLayout(new BoxLayout(res, BoxLayout.LINE_AXIS)); radioFormatHHMM = new JRadioButton("01:45"); radioFormatHHQuarters = new JRadioButton("1,75"); ButtonGroup grp = new ButtonGroup(); grp.add(radioFormatHHMM); grp.add(radioFormatHHQuarters);//from w w w. ja va2 s . co m res.add(radioFormatHHMM); res.add(Box.createHorizontalStrut(5)); res.add(radioFormatHHQuarters); res.setBorder(BorderFactory.createTitledBorder(RC.getString("settingseditor.timeformat.title"))); return res; }
From source file:visolate.Visolate.java
private Box getToolpathBox() { Dimension d;/*from w w w . ja v a 2s .c o m*/ Box toolpathsBox = Box.createHorizontalBox(); toolpathsButton = new JButton("Make Toolpaths"); toolpathsButton.setBackground(Color.WHITE); toolpathsButton.setVerticalAlignment(AbstractButton.CENTER); toolpathsButton.setHorizontalAlignment(AbstractButton.CENTER); d = toolpathsButton.getPreferredSize(); toolpathsButton.setMaximumSize(new Dimension(d.width, d.height)); toolpathsButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { computeToolpaths(); } }); toolpathsBox.add(toolpathsButton); // toolpathsBox.add(Box.createHorizontalStrut(16)); ButtonGroup modeGroup = new ButtonGroup(); voronoiButton = new JRadioButton("voronoi"); modeGroup.add(voronoiButton); voronoiButton.setBackground(Color.WHITE); // VORONOI_MODE is the default mode. voronoiButton.setSelected(true); toolpathsBox.add(voronoiButton); outlineButton = new JRadioButton("outline"); modeGroup.add(outlineButton); outlineButton.setBackground(Color.WHITE); // VORONOI_MODE is the default mode. outlineButton.setSelected(false); toolpathsBox.add(outlineButton); return toolpathsBox; }
From source file:xtrememp.XtremeMP.java
protected void createMenuBar() { menuBar = new JMenuBar(); // File Menu/*from ww w . j a va 2 s . co m*/ String fileMenuStr = tr("MainFrame.Menu.File"); fileMenu = new JMenu(fileMenuStr); fileMenu.setMnemonic(fileMenuStr.charAt(0)); openMenuItem = new JMenuItem(tr("MainFrame.Menu.File.OpenFile")); openMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_DOWN_MASK)); openMenuItem.setIcon(Utilities.FOLDER_ICON); openMenuItem.addActionListener(this); fileMenu.add(openMenuItem); openURLMenuItem = new JMenuItem(tr("MainFrame.Menu.File.OpenURL")); openURLMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_U, InputEvent.CTRL_DOWN_MASK)); openURLMenuItem.setIcon(Utilities.FOLDER_REMOTE_ICON); openURLMenuItem.addActionListener(this); fileMenu.add(openURLMenuItem); fileMenu.addSeparator(); openPlaylistMenuItem = new JMenuItem(tr("MainFrame.Menu.File.OpenPlaylist")); openPlaylistMenuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK)); openPlaylistMenuItem.setIcon(Utilities.DOCUMENT_OPEN_ICON); openPlaylistMenuItem.addActionListener(this); fileMenu.add(openPlaylistMenuItem); savePlaylistMenuItem = new JMenuItem(tr("MainFrame.Menu.File.SavePlaylist")); savePlaylistMenuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK)); savePlaylistMenuItem.setIcon(Utilities.DOCUMENT_SAVE_ICON); savePlaylistMenuItem.addActionListener(this); fileMenu.add(savePlaylistMenuItem); fileMenu.addSeparator(); preferencesMenuItem = new JMenuItem(tr("MainFrame.Menu.File.Preferences")); preferencesMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, InputEvent.CTRL_DOWN_MASK)); preferencesMenuItem.addActionListener(this); fileMenu.add(preferencesMenuItem); fileMenu.addSeparator(); exitMenuItem = new JMenuItem(tr("MainFrame.Menu.File.Exit")); exitMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_DOWN_MASK)); exitMenuItem.addActionListener(this); fileMenu.add(exitMenuItem); menuBar.add(fileMenu); // Player Menu String playerMenuStr = tr("MainFrame.Menu.Player"); playerMenu = new JMenu(playerMenuStr); playerMenu.setMnemonic(playerMenuStr.charAt(0)); playPauseMenuItem = new JMenuItem(tr("MainFrame.Menu.Player.Play")); playPauseMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_DOWN_MASK)); playPauseMenuItem.addActionListener(this); playerMenu.add(playPauseMenuItem); stopMenuItem = new JMenuItem(tr("MainFrame.Menu.Player.Stop")); stopMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_B, InputEvent.CTRL_DOWN_MASK)); // stopMenuItem.setIcon(Utilities.MEDIA_STOP_ICON); stopMenuItem.setEnabled(false); stopMenuItem.addActionListener(this); playerMenu.add(stopMenuItem); previousMenuItem = new JMenuItem(tr("MainFrame.Menu.Player.Previous")); previousMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_DOWN_MASK)); // previousMenuItem.setIcon(Utilities.MEDIA_PREVIOUS_ICON); previousMenuItem.setEnabled(false); previousMenuItem.addActionListener(this); playerMenu.add(previousMenuItem); nextMenuItem = new JMenuItem(tr("MainFrame.Menu.Player.Next")); nextMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.CTRL_DOWN_MASK)); // nextMenuItem.setIcon(Utilities.MEDIA_NEXT_ICON); nextMenuItem.setEnabled(false); nextMenuItem.addActionListener(this); playerMenu.add(nextMenuItem); playerMenu.addSeparator(); //PlayMode submenu String playModeSubMenuStr = tr("MainFrame.Menu.Player.PlayMode"); playModeSubMenu = new JMenu(playModeSubMenuStr); playModeRepeatNoneMenuItem = new JRadioButtonMenuItem(tr("MainFrame.Menu.Player.PlayMode.RepeatNone")); playModeRepeatNoneMenuItem.setIcon(Utilities.PLAYLIST_REPEAT_NONE_ICON); playModeRepeatNoneMenuItem.addActionListener(this); playModeSubMenu.add(playModeRepeatNoneMenuItem); playModeRepeatOneMenuItem = new JRadioButtonMenuItem(tr("MainFrame.Menu.Player.PlayMode.RepeatOne")); playModeRepeatOneMenuItem.setIcon(Utilities.PLAYLIST_REPEAT_ONE_ICON); playModeRepeatOneMenuItem.addActionListener(this); playModeSubMenu.add(playModeRepeatOneMenuItem); playModeRepeatAllMenuItem = new JRadioButtonMenuItem(tr("MainFrame.Menu.Player.PlayMode.RepeatAll")); playModeRepeatAllMenuItem.setIcon(Utilities.PLAYLIST_REPEAT_ALL_ICON); playModeRepeatAllMenuItem.addActionListener(this); playModeSubMenu.add(playModeRepeatAllMenuItem); playModeShuffleMenuItem = new JRadioButtonMenuItem(tr("MainFrame.Menu.Player.PlayMode.Shuffle")); playModeShuffleMenuItem.setIcon(Utilities.PLAYLIST_SHUFFLE_ICON); playModeShuffleMenuItem.addActionListener(this); playModeSubMenu.add(playModeShuffleMenuItem); ButtonGroup playModeBG = new ButtonGroup(); playModeBG.add(playModeRepeatNoneMenuItem); playModeBG.add(playModeRepeatOneMenuItem); playModeBG.add(playModeRepeatAllMenuItem); playModeBG.add(playModeShuffleMenuItem); playerMenu.add(playModeSubMenu); playerMenu.addSeparator(); randomizePlaylistMenuItem = new JMenuItem(tr("MainFrame.Menu.Player.Randomize")); randomizePlaylistMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.CTRL_DOWN_MASK)); randomizePlaylistMenuItem.setEnabled(false); randomizePlaylistMenuItem.addActionListener(this); playerMenu.add(randomizePlaylistMenuItem); menuBar.add(playerMenu); // View Menu String viewMenuStr = tr("MainFrame.Menu.View"); viewMenu = new JMenu(viewMenuStr); viewMenu.setMnemonic(viewMenuStr.charAt(0)); playlistManagerMenuItem = new JRadioButtonMenuItem(tr("MainFrame.Menu.View.PlaylistManager")); playlistManagerMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_L, InputEvent.CTRL_DOWN_MASK)); playlistManagerMenuItem.addActionListener(this); viewMenu.add(playlistManagerMenuItem); visualizationMenuItem = new JRadioButtonMenuItem(tr("MainFrame.Menu.View.Visualizations")); visualizationMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_K, InputEvent.CTRL_DOWN_MASK)); visualizationMenuItem.addActionListener(this); viewMenu.add(visualizationMenuItem); ButtonGroup viewBG = new ButtonGroup(); viewBG.add(playlistManagerMenuItem); viewBG.add(visualizationMenuItem); menuBar.add(viewMenu); // Help menu String helpMenuStr = tr("MainFrame.Menu.Help"); helpMenu = new JMenu(helpMenuStr); helpMenu.setMnemonic(helpMenuStr.charAt(0)); updateMenuItem = new JMenuItem(tr("MainFrame.Menu.Help.CheckForUpdates")); updateMenuItem.addActionListener(this); helpMenu.add(updateMenuItem); helpMenu.addSeparator(); aboutMenuItem = new JMenuItem(tr("MainFrame.Menu.Help.About")); aboutMenuItem.addActionListener(this); helpMenu.add(aboutMenuItem); menuBar.add(helpMenu); menuBar.add(Box.createHorizontalGlue()); busyLabel = new BusyLabel(new Dimension(20, 20)); menuBar.add(busyLabel); menuBar.add(Box.createHorizontalStrut(8)); mainFrame.setJMenuBar(menuBar); }
From source file:zsk.JFCMainClient.java
/** * @param pane//from w w w . j a v a2 s . c o m * @param downloadDir */ public void addComponentsToPane(final Container pane, String downloadDir) { this.panel = new JPanel(); this.panel.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = new Insets(5, 5, 5, 5); gbc.anchor = GridBagConstraints.WEST; JFCMainClient.dlm = new DefaultListModel<String>(); this.urllist = new JList<String>(JFCMainClient.dlm); // TODO maybe we add a button to remove added URLs from list? // this.userlist.setSelectionMode( ListSelectionModel.MULTIPLE_INTERVAL_SELECTION ); this.urllist.setFocusable(false); this.textarea = new JTextArea(2, 2); this.textarea.setEditable(true); this.textarea.setFocusable(false); JScrollPane leftscrollpane = new JScrollPane(this.urllist); JScrollPane rightscrollpane = new JScrollPane(this.textarea); this.middlepane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftscrollpane, rightscrollpane); this.middlepane.setOneTouchExpandable(true); this.middlepane.setDividerLocation(150); Dimension minimumSize = new Dimension(25, 25); leftscrollpane.setMinimumSize(minimumSize); rightscrollpane.setMinimumSize(minimumSize); this.directorybutton = new JButton("", createImageIcon("images/open.png", "")); gbc.gridx = 0; gbc.gridy = 0; this.directorybutton.addActionListener(this); this.panel.add(this.directorybutton, gbc); this.saveconfigcheckbox = new JCheckBox(isgerman() ? "Konfig. speichern" : "Save config"); this.saveconfigcheckbox.setSelected(false); this.saveconfigcheckbox.addItemListener(this); this.panel.add(this.saveconfigcheckbox); this.saveconfigcheckbox.setEnabled(false); // TODO check if initial download directory exists // assume that at least the users homedir exists //if (System.getProperty("user.home").equals("/home/knoedel")) shomedir = "/home/knoedel/YouTube Downloads/"; debugoutput("user.home: ".concat(System.getProperty("user.home")).concat(" shomedir: ".concat(shomedir))); debugoutput("os.name: ".concat(System.getProperty("os.name"))); debugoutput("os.arch: ".concat(System.getProperty("os.arch"))); debugoutput("os.version: ".concat(System.getProperty("os.version"))); debugoutput("Locale.getDefault: ".concat(Locale.getDefault().toString())); gbc.gridx = 0; gbc.gridy = 2; gbc.gridwidth = 2; gbc.fill = GridBagConstraints.HORIZONTAL; this.directorytextfield = new JTextField(downloadDir, 20 + (JFCMainClient.getbDEBUG() ? 48 : 0)); //this.directorytextfield = new JTextField( shomedir, 20+(JFCMainClient.getbDEBUG()?48:0) ); this.directorytextfield.setEnabled(false); this.directorytextfield.setFocusable(true); this.directorytextfield.addActionListener(this); this.panel.add(this.directorytextfield, gbc); JLabel dirhint = new JLabel(isgerman() ? "Speichern im Ordner:" : "Download to folder:"); gbc.gridx = 0; gbc.gridy = 1; this.panel.add(dirhint, gbc); debugoutput(String.format("heigth x width: %d x %d", Toolkit.getDefaultToolkit().getScreenSize().width, Toolkit.getDefaultToolkit().getScreenSize().height)); this.middlepane.setPreferredSize(new Dimension(Toolkit.getDefaultToolkit().getScreenSize().width / 3, Toolkit.getDefaultToolkit().getScreenSize().height / 4 + (JFCMainClient.getbDEBUG() ? 200 : 0))); gbc.gridx = 0; gbc.gridy = 3; gbc.fill = GridBagConstraints.BOTH; gbc.weighty = 2; gbc.weightx = 2; gbc.gridwidth = 2; this.panel.add(this.middlepane, gbc); // radio buttons for resolution to download JFCMainClient.frame.hdbutton = new JRadioButton("HD"); JFCMainClient.frame.hdbutton.setActionCommand("hd"); JFCMainClient.frame.hdbutton.addActionListener(this); JFCMainClient.frame.hdbutton.setToolTipText("1080p/720p"); JFCMainClient.frame.stdbutton = new JRadioButton("Std"); JFCMainClient.frame.stdbutton.setActionCommand("std"); JFCMainClient.frame.stdbutton.addActionListener(this); JFCMainClient.frame.stdbutton.setToolTipText("480p/360p"); JFCMainClient.frame.ldbutton = new JRadioButton("LD"); JFCMainClient.frame.ldbutton.setActionCommand("ld"); JFCMainClient.frame.ldbutton.addActionListener(this); JFCMainClient.frame.ldbutton.setToolTipText("< 360p"); JFCMainClient.frame.stdbutton.setSelected(true); JFCMainClient.frame.hdbutton.setEnabled(true); JFCMainClient.frame.ldbutton.setEnabled(true); ButtonGroup bgroup = new ButtonGroup(); bgroup.add(JFCMainClient.frame.hdbutton); bgroup.add(JFCMainClient.frame.stdbutton); bgroup.add(JFCMainClient.frame.ldbutton); JPanel radiopanel = new JPanel(new GridLayout(1, 0)); radiopanel.add(JFCMainClient.frame.hdbutton); radiopanel.add(JFCMainClient.frame.stdbutton); radiopanel.add(JFCMainClient.frame.ldbutton); gbc.gridx = 1; gbc.gridy = 0; gbc.gridheight = 0; gbc.gridwidth = 0; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.NORTHEAST; this.panel.add(radiopanel, gbc); // radio buttons for video format to download JFCMainClient.frame.mpgbutton = new JRadioButton("MPEG"); JFCMainClient.frame.mpgbutton.setActionCommand("mpg"); JFCMainClient.frame.mpgbutton.addActionListener(this); JFCMainClient.frame.mpgbutton.setToolTipText("Codec: H.264 MPEG-4"); JFCMainClient.frame.webmbutton = new JRadioButton("WEBM"); JFCMainClient.frame.webmbutton.setActionCommand("webm"); JFCMainClient.frame.webmbutton.addActionListener(this); JFCMainClient.frame.webmbutton.setToolTipText("Codec: Google/On2's VP8 or Googles WebM"); JFCMainClient.frame.flvbutton = new JRadioButton("FLV"); JFCMainClient.frame.flvbutton.setActionCommand("flv"); JFCMainClient.frame.flvbutton.addActionListener(this); JFCMainClient.frame.flvbutton.setToolTipText("Codec: Flash Video (FLV1)"); bgroup = new ButtonGroup(); bgroup.add(JFCMainClient.frame.mpgbutton); bgroup.add(JFCMainClient.frame.webmbutton); bgroup.add(JFCMainClient.frame.flvbutton); JFCMainClient.frame.mpgbutton.setSelected(true); JFCMainClient.frame.mpgbutton.setEnabled(true); JFCMainClient.frame.webmbutton.setEnabled(true); JFCMainClient.frame.flvbutton.setEnabled(true); JFCMainClient.frame.save3dcheckbox = new JCheckBox("3D"); JFCMainClient.frame.save3dcheckbox.setToolTipText("stereoscopic video"); JFCMainClient.frame.save3dcheckbox.setSelected(false); JFCMainClient.frame.save3dcheckbox.setEnabled(true); JFCMainClient.frame.save3dcheckbox.addItemListener(this); radiopanel = new JPanel(new GridLayout(1, 0)); radiopanel.add(JFCMainClient.frame.save3dcheckbox); radiopanel.add(JFCMainClient.frame.mpgbutton); radiopanel.add(JFCMainClient.frame.webmbutton); radiopanel.add(JFCMainClient.frame.flvbutton); gbc.gridx = 1; gbc.gridy = 1; gbc.gridheight = 0; gbc.gridwidth = 0; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.NORTHEAST; this.panel.add(radiopanel, gbc); JLabel hint = new JLabel( isgerman() ? "eingeben, reinkopieren, reinziehen von YT-Webadressen oder YT-Videobilder:" : "Type, paste or drag'n drop a YouTube video address:"); gbc.fill = 0; gbc.gridwidth = 0; gbc.gridheight = 1; gbc.weightx = 0; gbc.weighty = 0; gbc.gridx = 0; gbc.gridy = 4; gbc.anchor = GridBagConstraints.WEST; this.panel.add(hint, gbc); this.textinputfield = new JTextField(20); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridx = 0; gbc.gridy = 5; gbc.gridwidth = 2; this.textinputfield.setEnabled(true); this.textinputfield.setFocusable(true); this.textinputfield.addActionListener(this); this.textinputfield.getDocument().addDocumentListener(this); this.panel.add(this.textinputfield, gbc); this.quitbutton = new JButton("", createImageIcon("images/exit.png", "")); gbc.gridx = 2; gbc.gridy = 5; gbc.gridwidth = 0; this.quitbutton.addActionListener(this); this.quitbutton.setActionCommand("quit"); this.quitbutton.setToolTipText("Exit."); this.panel.add(this.quitbutton, gbc); pane.add(this.panel); addWindowListener(this); JFCMainClient.frame.setDropTarget(new DropTarget(this, this)); JFCMainClient.frame.textarea.setTransferHandler(null); // otherwise the dropped text would be inserted }