List of usage examples for javax.swing JLabel setLabelFor
@BeanProperty(description = "The component this is labelling.") public void setLabelFor(Component c)
From source file:org.gofleet.module.routing.RoutingMap.java
private Map<String, String> getValues(LatLon from) { final Map<String, String> mapa = new HashMap<String, String>(); final JDialog frame = new JDialog(basicWindow.getFrame(), "Configuration"); JPanel panel = new JPanel(new GridLayout(0, 2)); int width = 10; final JTextField maxDistance = new JTextField(width); maxDistance.setText("10"); final JTextField maxTime = new JTextField(width); maxTime.setText("8"); final JTextField origin_x = new JTextField(width / 2); origin_x.setText((new Double(from.getX())).toString()); final JTextField origin_y = new JTextField(width / 2); origin_y.setText((new Double(from.getY())).toString()); final JTextField startTime = new JTextField(width); startTime.setText("7"); final JTextField timeSpentOnStop = new JTextField(width); timeSpentOnStop.setText("1"); JLabel lmaxDistance = new JLabel("Maximum Distance (km)"); lmaxDistance.setLabelFor(maxDistance); JLabel lmaxTime = new JLabel("Maximum Time (hours)"); lmaxTime.setLabelFor(maxTime);//from ww w .ja v a 2 s . co m JLabel lorigin = new JLabel("Point of Origin"); lorigin.setLabelFor(origin_x); JLabel lstartTime = new JLabel("Start Time of Plan (0-24)"); lstartTime.setLabelFor(startTime); JLabel ltimeSpentOnStop = new JLabel("Time Spent on Stop (hours)"); ltimeSpentOnStop.setLabelFor(timeSpentOnStop); JButton close = new JButton("OK"); close.addActionListener(new AbstractAction() { private static final long serialVersionUID = -8912729211256933464L; @Override public void actionPerformed(ActionEvent arg0) { try { mapa.put("maxDistance", maxDistance.getText()); mapa.put("maxTime", maxTime.getText()); mapa.put("origin_x", origin_x.getText()); mapa.put("origin_y", origin_y.getText()); mapa.put("startTime", startTime.getText()); mapa.put("timeSpentOnStop", timeSpentOnStop.getText()); frame.dispose(); } catch (Throwable t) { log.error("Error configuring New Route Plan" + t); JOptionPane.showMessageDialog(RoutingMap.this, "Some values are wrong. Check them again."); } } }); panel.add(lmaxDistance); panel.add(maxDistance); panel.add(lmaxTime); panel.add(maxTime); panel.add(lorigin); JPanel panel_origin = new JPanel(); panel_origin.add(origin_x); panel_origin.add(origin_y); panel.add(panel_origin); panel.add(lstartTime); panel.add(startTime); panel.add(ltimeSpentOnStop); panel.add(timeSpentOnStop); panel.add(close); frame.add(panel, BorderLayout.CENTER); frame.pack(); frame.setModalityType(ModalityType.APPLICATION_MODAL); frame.setVisible(true); return mapa; }
From source file:org.javaswift.cloudie.CloudiePanel.java
public JMenuBar createMenuBar() { JMenuBar bar = new JMenuBar(); JMenu accountMenu = new JMenu("Account"); JMenu containerMenu = new JMenu("Container"); JMenu storedObjectMenu = new JMenu("StoredObject"); JMenu helpMenu = new JMenu("Help"); accountMenu.setMnemonic('A'); containerMenu.setMnemonic('C'); storedObjectMenu.setMnemonic('O'); helpMenu.setMnemonic('H'); bar.add(accountMenu);//w w w . ja va 2s. co m bar.add(containerMenu); bar.add(storedObjectMenu); bar.add(helpMenu); JPanel panel = new JPanel(new FlowLayout(SwingConstants.RIGHT, 0, 0)); JLabel label = new JLabel(getIcon("zoom.png")); label.setLabelFor(searchTextField); label.setDisplayedMnemonic('f'); panel.add(label); panel.add(searchTextField); bar.add(panel); // accountMenu.add(new JMenuItem(accountLoginAction)); accountMenu.add(new JMenuItem(accountLogoutAction)); accountMenu.addSeparator(); accountMenu.add(new JMenuItem(accountQuitAction)); // containerMenu.add(new JMenuItem(containerRefreshAction)); containerMenu.add(new JMenuItem(containerViewMetaData)); containerMenu.addSeparator(); containerMenu.add(new JMenuItem(containerCreateAction)); containerMenu.add(new JMenuItem(containerDeleteAction)); containerMenu.addSeparator(); containerMenu.add(new JMenuItem(containerEmptyAction)); containerMenu.addSeparator(); containerMenu.add(new JMenuItem(containerPurgeAction)); // storedObjectMenu.add(new JMenuItem(storedObjectPreviewAction)); storedObjectMenu.add(new JMenuItem(storedObjectOpenAction)); storedObjectMenu.add(new JMenuItem(storedObjectViewMetaData)); storedObjectMenu.addSeparator(); storedObjectMenu.add(new JMenuItem(storedObjectCreateAction)); storedObjectMenu.add(new JMenuItem(storedObjectDownloadAction)); storedObjectMenu.addSeparator(); storedObjectMenu.add(new JMenuItem(storedObjectDeleteAction)); // helpMenu.add(new JMenuItem(aboutAction)); // return bar; }
From source file:org.nuclos.client.main.mainframe.workspace.WorkspaceEditor.java
public WorkspaceEditor(WorkspaceVO wovo) { final SpringLocaleDelegate localeDelegate = SpringLocaleDelegate.getInstance(); this.wovo = wovo; this.backup = new WorkspaceVO(); this.backup.importHeader(wovo.getWoDesc()); boolean showAlwaysReset = wovo.isAssigned() && SecurityCache.getInstance().isActionAllowed(Actions.ACTION_WORKSPACE_ASSIGN); contentPanel = new JPanel(); initJPanel(contentPanel,// w ww. ja v a 2s. c o m new double[] { TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL }, new double[] { 20, 20, 20, 20, showAlwaysReset ? 20 : 0, 10, 20, TableLayout.FILL, TableLayout.PREFERRED }); contentPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JLabel lbName = new JLabel(localeDelegate.getMessage("WorkspaceEditor.2", "Name"), JLabel.TRAILING); contentPanel.add(lbName, "0, 0"); tfName = new JTextField(15); lbName.setLabelFor(tfName); contentPanel.add(tfName, "1, 0"); chckHideName = new JCheckBox(localeDelegate.getMessage("WorkspaceEditor.3", "Name ausblenden")); contentPanel.add(chckHideName, "2, 0, 3, 0"); chckHide = new JCheckBox(localeDelegate.getMessage("WorkspaceEditor.8", "Auswahl Button ausblenden")); if (wovo.isAssigned() && SecurityCache.getInstance().isActionAllowed(Actions.ACTION_WORKSPACE_ASSIGN)) { contentPanel.add(chckHide, "4, 0"); } chckAlwaysOpenAtLogin = new JCheckBox( localeDelegate.getMessage("WorkspaceEditor.11", "Immer bei Anmeldung ffnen")); contentPanel.add(chckAlwaysOpenAtLogin, "1, 1"); JLabel lbMainFrame = new JLabel(localeDelegate.getMessage("WorkspaceEditor.9", "Hauptfenster"), JLabel.TRAILING); contentPanel.add(lbMainFrame, "0, 2"); chckHideMenuBar = new JCheckBox(localeDelegate.getMessage("WorkspaceEditor.10", "Nur Standard Menuleiste")); contentPanel.add(chckHideMenuBar, "1, 2"); chckUseLastFrameSettings = new JCheckBox(localeDelegate.getMessage("WorkspaceEditor.12", "Letzte Fenster Einstellungen bernehmen (Gre und Position)")); contentPanel.add(chckUseLastFrameSettings, "1, 3, 5, 3"); chckAlwaysReset = new JCheckBox(localeDelegate.getMessage("WorkspaceEditor.alwaysreset", "Zuletzt geffnete Tabs immer zurcksetzen")); if (showAlwaysReset) { contentPanel.add(chckAlwaysReset, "1, 4, 5, 4"); } JTabbedPane tbbdPane = new JTabbedPane(); nuclosIconChooser = new ResourceIconChooser(WorkspaceChooserController.ICON_SIZE, NuclosResourceCategory.ENTITY_ICON); nuclosIconChooser.removeBorder(); tbbdPane.addTab(localeDelegate.getMessage("WorkspaceEditor.4", "Icon"), nuclosIconChooser); JPanel parameterPanel = new JPanel(new BorderLayout()); parameterModel = new ParameterModel(); jtbParameter = new JTable(parameterModel); JScrollPane parameterScroller = new JScrollPane(jtbParameter); jtbParameter.setFillsViewportHeight(true); jtbParameter.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); jtbParameter.getColumnModel().getColumn(0).setPreferredWidth(100); jtbParameter.getColumnModel().getColumn(1).setPreferredWidth(400); parameterPanel.add(parameterScroller, BorderLayout.CENTER); JToolBar parameterTools = UIUtils.createNonFloatableToolBar(JToolBar.VERTICAL); parameterTools.add(new ParameterAddButton()); btRemoveParameter = new ParameterRemoveButton(); btRemoveParameter.setEnabled(false); parameterTools.add(btRemoveParameter); parameterPanel.add(parameterTools, BorderLayout.WEST); tbbdPane.addTab(localeDelegate.getMessage("WorkspaceEditor.13", "Parameter"), parameterPanel); contentPanel.add(tbbdPane, "1, 6, 5, 7"); JPanel actionsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 2)); btSave = new JButton(localeDelegate.getMessage("WorkspaceEditor.5", "Speichern")); btCancel = new JButton(localeDelegate.getMessage("WorkspaceEditor.6", "Abbrechen")); actionsPanel.add(btSave); actionsPanel.add(btCancel); contentPanel.add(actionsPanel, "0, 8, 5, 8"); tfName.setText(wovo.getWoDesc().getName()); chckHide.setSelected(wovo.getWoDesc().isHide()); chckHideName.setSelected(wovo.getWoDesc().isHideName()); chckHideMenuBar.setSelected(wovo.getWoDesc().isHideMenuBar()); chckAlwaysOpenAtLogin.setSelected(wovo.getWoDesc().isAlwaysOpenAtLogin()); chckUseLastFrameSettings.setSelected(wovo.getWoDesc().isUseLastFrameSettings()); chckAlwaysReset.setSelected(wovo.getWoDesc().isAlwaysReset()); nuclosIconChooser.setSelected(wovo.getWoDesc().getNuclosResource()); parameterModel.setParamters(wovo.getWoDesc().getParameters()); dialog = new JDialog(Main.getInstance().getMainFrame(), localeDelegate.getMessage("WorkspaceEditor.1", "Arbeitsumgebung Eigenschaften"), true); dialog.setContentPane(contentPanel); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.getRootPane().setDefaultButton(btSave); Rectangle mfBounds = Main.getInstance().getMainFrame().getBounds(); dialog.setBounds(mfBounds.x + (mfBounds.width / 2) - 300, mfBounds.y + (mfBounds.height / 2) - 200, 600, 400); dialog.setResizable(false); initListener(); dialog.setVisible(true); }
From source file:org.nuxeo.launcher.sync.NuxeoSyncFrame.java
protected Component buildSyncPanel() { syncPanel = new JPanel(); syncPanel.setBackground(new Color(55, 55, 55)); syncPanel.setForeground(Color.WHITE); syncPanel.setLayout(new GridBagLayout()); JLabel l = new JLabel("Server IP", SwingConstants.TRAILING); l.setForeground(Color.WHITE); GridBagConstraints c = new GridBagConstraints(); c.weightx = 1.0;//from w w w . ja v a 2 s . c om c.gridx = 0; c.gridy = 0; c.anchor = GridBagConstraints.EAST; c.insets = new Insets(0, 0, 0, 0); syncPanel.add(l, c); syncServerIpTextField = new JTextField(10); l.setLabelFor(syncServerIpTextField); c.gridx = 1; c.gridy = 0; c.anchor = GridBagConstraints.WEST; syncPanel.add(syncServerIpTextField, c); l = new JLabel("Port", SwingConstants.TRAILING); l.setForeground(Color.WHITE); c.gridx = 0; c.gridy = 2; c.anchor = GridBagConstraints.EAST; syncPanel.add(l, c); syncPortTextField = new JTextField(10); l.setLabelFor(syncPortTextField); c.gridx = 1; c.gridy = 2; c.anchor = GridBagConstraints.WEST; syncPanel.add(syncPortTextField, c); l = new JLabel("Login", SwingConstants.TRAILING); l.setForeground(Color.WHITE); c.gridx = 0; c.gridy = 3; c.anchor = GridBagConstraints.EAST; syncPanel.add(l, c); syncLoginTextField = new JTextField(10); l.setLabelFor(syncLoginTextField); c.gridx = 1; c.gridy = 3; c.anchor = GridBagConstraints.WEST; syncPanel.add(syncLoginTextField, c); l = new JLabel("Password", SwingConstants.TRAILING); l.setForeground(Color.WHITE); c.gridx = 0; c.gridy = 4; c.anchor = GridBagConstraints.EAST; syncPanel.add(l, c); syncPasswordField = new JPasswordField(10); l.setLabelFor(syncPasswordField); c.gridx = 1; c.gridy = 4; c.anchor = GridBagConstraints.WEST; syncPanel.add(syncPasswordField, c); syncButton = new JButton(); c.fill = GridBagConstraints.NONE; c.gridx = 0; c.gridy = 5; c.gridwidth = 2; c.insets = new Insets(10, 0, 0, 0); c.anchor = GridBagConstraints.CENTER; // set the action to the button synchronizeAction = createSyncAction(); syncButton.setAction(synchronizeAction); syncButton.setText("Synchronize"); updateSyncButton(); syncPanel.add(syncButton, c); errorMessageLabel = new JLabel("", SwingConstants.TRAILING); errorMessageLabel.setForeground(Color.RED); c.gridx = 0; c.gridy = 6; c.gridwidth = 2; c.fill = GridBagConstraints.HORIZONTAL; c.insets = new Insets(10, 0, 0, 0); c.anchor = GridBagConstraints.CENTER; syncPanel.add(errorMessageLabel, c); return syncPanel; }
From source file:org.opendatakit.appengine.updater.UpdaterWindow.java
/** * Create the application.// ww w . j ava 2 s .co m */ public UpdaterWindow(CommandLine cmd) { super(); AnnotationProcessor.process(this);// if not using AOP this.cmd = cmd; frame = new JFrame(); frame.setBounds(100, 100, isLinux() ? 720 : 680, 595); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.addWindowListener(new WindowListener() { @Override public void windowOpened(WindowEvent e) { } @Override public void windowClosing(WindowEvent e) { } @Override public void windowClosed(WindowEvent e) { } @Override public void windowIconified(WindowEvent e) { } @Override public void windowDeiconified(WindowEvent e) { } @Override public void windowActivated(WindowEvent e) { } @Override public void windowDeactivated(WindowEvent e) { } }); JLabel lblEmail = new JLabel(t(TranslatedStrings.EMAIL_LABEL)); txtEmail = new JTextField(); txtEmail.setFocusable(true); txtEmail.setEditable(true); txtEmail.setColumns(60); txtEmail.setMaximumSize(txtEmail.getPreferredSize()); if (cmd.hasOption(ArgumentNameConstants.EMAIL)) { txtEmail.setText(cmd.getOptionValue(ArgumentNameConstants.EMAIL)); } lblEmail.setLabelFor(txtEmail); JLabel lblToken = new JLabel(t(TranslatedStrings.TOKEN_GRANTING_LABEL)); txtToken = new JTextField(); txtToken.setColumns(60); txtToken.setMaximumSize(txtToken.getPreferredSize()); txtToken.setFocusable(false); txtToken.setEditable(false); if (cmd.hasOption(ArgumentNameConstants.TOKEN_GRANTING_CODE)) { txtToken.setText(cmd.getOptionValue(ArgumentNameConstants.TOKEN_GRANTING_CODE)); } lblToken.setLabelFor(txtToken); // set up listener for updating warning message txtEmail.getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(DocumentEvent e) { updateUI(); } @Override public void removeUpdate(DocumentEvent e) { updateUI(); } @Override public void changedUpdate(DocumentEvent e) { updateUI(); } }); // set up listener for updating warning message txtToken.getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(DocumentEvent e) { updateUI(); } @Override public void removeUpdate(DocumentEvent e) { updateUI(); } @Override public void changedUpdate(DocumentEvent e) { updateUI(); } }); if ((txtEmail.getText().length() > 0) && ((txtToken.getText().length() > 0) || perhapsHasToken())) { lblWarning = new JLabel(t(TranslatedStrings.WARNING_ERRANT_LABEL)); } else { lblWarning = new JLabel(t(TranslatedStrings.WARNING_REDIRECT_LABEL)); } JLabel outputArea = new JLabel(t(TranslatedStrings.OUTPUT_LBL)); editorArea = new JTextPane(new DefaultStyledDocument()); editorArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12)); //Put the editor pane in a scroll pane. editorScrollPane = new JScrollPane(editorArea); editorScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); editorScrollPane.setPreferredSize(new Dimension(400, 300)); editorScrollPane.setMinimumSize(new Dimension(10, 10)); outputArea.setLabelFor(editorScrollPane); // Create a container so that we can add a title around // the scroll pane. Can't add a title directly to the // scroll pane because its background would be white. // Lay out the label and scroll pane from top to bottom. JPanel listPane = new JPanel(); listPane.setLayout(new BoxLayout(listPane, BoxLayout.PAGE_AXIS)); listPane.add(outputArea); listPane.add(Box.createRigidArea(new Dimension(0, 5))); listPane.add(editorScrollPane); listPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); btnDeleteToken = new JButton(t(TranslatedStrings.DELETE_TOKEN_LABEL)); btnDeleteToken.addActionListener(new DeleteTokenActionListener()); btnDeleteToken.setEnabled(perhapsHasToken()); btnChoose = new JButton(t(TranslatedStrings.GET_TOKEN_LABEL)); if ((txtEmail.getText().length() > 0) && (txtToken.getText().length() > 0) || perhapsHasToken()) { if (perhapsHasToken()) { btnChoose.setText(t(TranslatedStrings.VERIFY_TOKEN_LABEL)); } else { btnChoose.setText(t(TranslatedStrings.SET_TOKEN_LABEL)); } } else { btnChoose.setText(t(TranslatedStrings.GET_TOKEN_LABEL)); } btnChoose.addActionListener(new GetTokenActionListener()); btnChoose.setEnabled(txtEmail.getText().length() > 0); btnUpload = new JButton(t(TranslatedStrings.UPLOAD_LABEL)); btnUpload.addActionListener(new UploadActionListener()); btnUpload.setEnabled((txtEmail.getText().length() > 0) && perhapsHasToken()); btnRollback = new JButton(t(TranslatedStrings.ROLLBACK_LABEL)); btnRollback.addActionListener(new RollbackActionListener()); btnRollback.setEnabled((txtEmail.getText().length() > 0) && perhapsHasToken()); GroupLayout groupLayout = new GroupLayout(frame.getContentPane()); groupLayout .setHorizontalGroup( groupLayout.createSequentialGroup().addContainerGap() .addGroup(groupLayout.createParallelGroup(Alignment.LEADING).addComponent(lblEmail) .addComponent(txtEmail).addComponent(lblToken).addComponent(txtToken) .addComponent(lblWarning).addComponent(listPane) .addGroup(groupLayout.createSequentialGroup().addComponent(btnDeleteToken) .addGap(3 * HorizontalSpacing).addComponent(btnChoose) .addGap(HorizontalSpacing).addComponent(btnUpload) .addGap(3 * HorizontalSpacing, 4 * HorizontalSpacing, Short.MAX_VALUE) .addComponent(btnRollback))) .addContainerGap()); groupLayout.setVerticalGroup(groupLayout.createSequentialGroup().addContainerGap().addComponent(lblEmail) .addPreferredGap(ComponentPlacement.RELATED).addComponent(txtEmail) .addPreferredGap(ComponentPlacement.UNRELATED).addComponent(lblToken) .addPreferredGap(ComponentPlacement.RELATED).addComponent(txtToken) .addPreferredGap(ComponentPlacement.UNRELATED).addComponent(lblWarning) .addPreferredGap(ComponentPlacement.UNRELATED).addComponent(listPane) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE).addComponent(btnDeleteToken) .addComponent(btnChoose).addComponent(btnUpload).addComponent(btnRollback)) .addContainerGap()); frame.getContentPane().setLayout(groupLayout); frame.addWindowListener(this); }
From source file:org.openmicroscopy.shoola.util.ui.MessengerDialog.java
/** * Builds and lays out the panel hosting the <code>email</code> details. * /*from w w w . jav a2 s.com*/ * @param mnemonic The key-code that indicates a mnemonic key. * @return See above. */ private JPanel buildEmailAreaPanel(int mnemonic) { double[][] size = null; JPanel panel = new JPanel(); panel.setOpaque(false); if (EMAIL_SUFFIX.length() == 0) size = new double[][] { { TableLayout.PREFERRED, TableLayout.FILL }, { 30 } }; else size = new double[][] { { TableLayout.PREFERRED, TableLayout.FILL, TableLayout.PREFERRED }, { 30 } }; TableLayout layout = new TableLayout(size); panel.setLayout(layout); JLabel label = new JLabel(EMAIL_FIELD); label.setDisplayedMnemonic(mnemonic); label.setLabelFor(emailArea); label.setOpaque(false); panel.add(label, "0, 0, RIGHT, CENTER"); panel.add(emailArea, "1, 0, FULL, CENTER"); if (EMAIL_SUFFIX.length() != 0) panel.add(new JLabel(EMAIL_SUFFIX), "2, 0, LEFT, CENTER"); return panel; }
From source file:org.springframework.richclient.core.LabelInfo.java
/** * Configures the given label with the property values described by this instance and then sets * it as the label for the given component. * * @param label The label to be configured. * @param component The component that the label is 'for'. * * @throws IllegalArgumentException if either argument is null. * * @see JLabel#setLabelFor(java.awt.Component) *///from w w w . ja v a 2s .co m public void configureLabelFor(JLabel label, JComponent component) { Assert.required(label, "label"); Assert.required(component, "component"); configureLabel(label); if (!(component instanceof JPanel)) { String labelText = label.getText(); if (!labelText.endsWith(":")) { if (logger.isDebugEnabled()) { logger.debug("Appending colon to text field label text '" + this.text + "'"); } label.setText(labelText + ":"); } } label.setLabelFor(component); }
From source file:org.springframework.richclient.layout.GridBagLayoutBuilder.java
/** * Appends a label and field to the end of the current line.<p /> * * The label will be to the left of the field, and be right-justified.<br /> * The field will "grow" horizontally as space allows.<p /> * * @param label the label to associate and layout with the field * @param colSpan the number of columns the field should span * * @return "this" to make it easier to string together append calls *//* ww w . j ava2 s . c o m*/ public GridBagLayoutBuilder appendLabeledField(final JLabel label, final JComponent field, LabelOrientation labelOrientation, int colSpan, int rowSpan, boolean expandX, boolean expandY) { label.setLabelFor(field); final int col = getCurrentCol(); final int row = getCurrentRow(); final Insets insets = getDefaultInsets(); if (labelOrientation == LabelOrientation.LEFT || labelOrientation == null) { label.setHorizontalAlignment(SwingConstants.RIGHT); append(label, col, row, 1, 1, false, expandY, insets); append(field, col + 1, row, colSpan, rowSpan, expandX, expandY, insets); } else if (labelOrientation == LabelOrientation.RIGHT) { label.setHorizontalAlignment(SwingConstants.LEFT); append(field, col, row, colSpan, rowSpan, expandX, expandY, insets); append(label, col + colSpan, row, 1, rowSpan, false, expandY, insets); } else if (labelOrientation == LabelOrientation.TOP) { label.setHorizontalAlignment(SwingConstants.LEFT); append(label, col, row, colSpan, 1, expandX, false, insets); append(field, col, row + 1, colSpan, rowSpan, expandX, expandY, insets); } else if (labelOrientation == LabelOrientation.BOTTOM) { label.setHorizontalAlignment(SwingConstants.LEFT); append(field, col, row, colSpan, rowSpan, expandX, expandY, insets); append(label, col, row + rowSpan, colSpan, 1, expandX, false, insets); } return this; }
From source file:org.tinymediamanager.ui.dialogs.RegisterDonatorVersionDialog.java
public RegisterDonatorVersionDialog() { super(BUNDLE.getString("tmm.registerdonator"), "registerDonator"); //$NON-NLS-1$ setBounds(166, 5, 400, 300);/*from w ww .j a v a 2s . co m*/ boolean isDonator = Globals.isDonator(); Properties props = null; if (isDonator) { props = License.decrypt(); } { JPanel panelContent = new JPanel(); getContentPane().add(panelContent, BorderLayout.CENTER); panelContent.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("250px:grow"), FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormFactory.PARAGRAPH_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.UNRELATED_GAP_ROWSPEC, })); { JTextArea textArea = new JTextArea(); textArea.setOpaque(false); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); textArea.setEditable(false); panelContent.add(textArea, "2, 2, 3, 1, default, center"); if (isDonator) { textArea.setText(BUNDLE.getString("tmm.registerdonator.thanks")); //$NON-NLS-1$ } else { textArea.setText(BUNDLE.getString("tmm.registerdonator.hint")); //$NON-NLS-1$ } } { JLabel lblName = new JLabel(BUNDLE.getString("tmm.registerdonator.name")); //$NON-NLS-1$ panelContent.add(lblName, "2, 4, right, default"); tfName = new JTextField(""); lblName.setLabelFor(tfName); panelContent.add(tfName, "4, 4, fill, default"); tfName.setColumns(10); if (isDonator) { tfName.setText(props.getProperty("user")); tfName.setEnabled(false); } } { JLabel lblEmailAddress = new JLabel(BUNDLE.getString("tmm.registerdonator.email")); //$NON-NLS-1$ panelContent.add(lblEmailAddress, "2, 6, right, default"); tfEmailAddress = new JTextField(""); lblEmailAddress.setLabelFor(tfEmailAddress); panelContent.add(tfEmailAddress, "4, 6, fill, default"); tfEmailAddress.setColumns(10); if (isDonator) { tfEmailAddress.setText(props.getProperty("email")); tfEmailAddress.setEnabled(false); } } } { JPanel panelButtons = new JPanel(); panelButtons.setBorder(new EmptyBorder(4, 4, 4, 4)); getContentPane().add(panelButtons, BorderLayout.SOUTH); EqualsLayout layout = new EqualsLayout(5); layout.setMinWidth(100); panelButtons.setLayout(layout); { JButton btnRegister = new JButton(BUNDLE.getString("Button.register")); //$NON-NLS-1$ btnRegister.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); try { LOGGER.debug("registering for donator version: ", tfEmailAddress.getText()); Properties p = new Properties(); p.setProperty("user", tfName.getText()); p.setProperty("email", tfEmailAddress.getText()); p.setProperty("generated", String.valueOf(new Date().getTime())); p.setProperty("uuid", FileUtils.readFileToString(new File("tmm.uuid"))); // get encrypted string and write tmm.lic if (License.encrypt(p) && License.isValid()) { JOptionPane.showMessageDialog(RegisterDonatorVersionDialog.this, BUNDLE.getString("tmm.registerdonator.success")); //$NON-NLS-1$ setVisible(false); } else { JOptionPane.showMessageDialog(RegisterDonatorVersionDialog.this, BUNDLE.getString("tmm.registerdonator.error")); //$NON-NLS-1$ } } catch (Exception ex) { LOGGER.error("Error registering donator version: " + ex.getMessage()); } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }); if (isDonator) { btnRegister.setEnabled(false); } panelButtons.add(btnRegister); } { JButton btnClose = new JButton(BUNDLE.getString("Button.close")); //$NON-NLS-1$ btnClose.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { setVisible(false); } }); panelButtons.add(btnClose); } } addWindowListener(new WindowAdapter() { @Override public void windowOpened(WindowEvent e) { tfName.requestFocus(); } }); }
From source file:org.tinymediamanager.ui.movies.dialogs.MovieEditorDialog.java
/** * Create the dialog./*from w w w . j a va 2s . co m*/ * * @param movie * the movie * @param inQueue * the in queue */ public MovieEditorDialog(Movie movie, boolean inQueue) { super(BUNDLE.getString("movie.edit"), "movieEditor"); //$NON-NLS-1$ setBounds(5, 5, 950, 650); movieToEdit = movie; ids = MediaIdTable.convertIdMapToEventList(movieToEdit.getIds()); for (MediaFile mf : movie.getMediaFiles()) { mediaFiles.add(new MediaFile(mf)); } getContentPane().setLayout(new BorderLayout()); { JPanel panelPath = new JPanel(); getContentPane().add(panelPath, BorderLayout.NORTH); panelPath.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, RowSpec.decode("15px"), FormFactory.RELATED_GAP_ROWSPEC, })); JLabel lblMoviePathT = new JLabel(BUNDLE.getString("metatag.path")); //$NON-NLS-1$ panelPath.add(lblMoviePathT, "2, 2, left, top"); lblMoviePath = new JLabel(""); TmmFontHelper.changeFont(lblMoviePath, 1.166, Font.BOLD); panelPath.add(lblMoviePath, "5, 2, left, top"); } JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.NORTH); getContentPane().add(tabbedPane, BorderLayout.CENTER); /** * DetailsPanel 1 */ { details1Panel.setBorder(new EmptyBorder(5, 5, 5, 5)); details1Panel.setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(40dlu;default)"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("7dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("25dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("24dlu"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("7dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.UNRELATED_GAP_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("100dlu:grow(2)"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, RowSpec.decode("50px:grow"), FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("15dlu"), FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, RowSpec.decode("fill:50dlu:grow"), FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, RowSpec.decode("50px"), FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, RowSpec.decode("fill:default:grow"), })); { JLabel lblTitle = new JLabel(BUNDLE.getString("metatag.title")); //$NON-NLS-1$ details1Panel.add(lblTitle, "2, 4, right, default"); } { tfTitle = new JTextField(); details1Panel.add(tfTitle, "4, 4, 15, 1, fill, default"); tfTitle.setColumns(10); } { // JLabel lblPoster = new JLabel(""); lblPoster = new ImageLabel(); lblPoster.setAlternativeText(BUNDLE.getString("image.notfound.poster")); //$NON-NLS-1$ lblPoster.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { ImageChooserDialog dialog = new ImageChooserDialog(movieToEdit.getIds(), ImageType.POSTER, movieList.getDefaultArtworkScrapers(), lblPoster, null, null, MediaType.MOVIE); dialog.setLocationRelativeTo(MainWindow.getActiveInstance()); dialog.setVisible(true); } }); lblPoster.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); details1Panel.add(lblPoster, "22, 4, 3, 23, fill, fill"); } { JLabel lblOriginalTitle = new JLabel(BUNDLE.getString("metatag.originaltitle")); //$NON-NLS-1$ details1Panel.add(lblOriginalTitle, "2, 6, right, default"); } { tfOriginalTitle = new JTextField(); details1Panel.add(tfOriginalTitle, "4, 6, 15, 1, fill, top"); tfOriginalTitle.setColumns(10); } { JLabel lblSorttitle = new JLabel(BUNDLE.getString("metatag.sorttitle")); //$NON-NLS-1$ details1Panel.add(lblSorttitle, "2, 8, right, default"); } { tfSorttitle = new JTextField(); details1Panel.add(tfSorttitle, "4, 8, 15, 1, fill, default"); tfSorttitle.setColumns(10); } { JLabel lblTagline = new JLabel(BUNDLE.getString("metatag.tagline")); //$NON-NLS-1$ details1Panel.add(lblTagline, "2, 10, right, top"); } { JScrollPane scrollPaneTagline = new JScrollPane(); tpTagline = new JTextPane(); scrollPaneTagline.setViewportView(tpTagline); details1Panel.add(scrollPaneTagline, "4, 10, 15, 1, fill, fill"); } { JLabel lblYear = new JLabel(BUNDLE.getString("metatag.year")); //$NON-NLS-1$ details1Panel.add(lblYear, "2, 12, right, default"); } { spYear = new YearSpinner(); details1Panel.add(spYear, "4, 12, fill, top"); } { JLabel lblRuntime = new JLabel(BUNDLE.getString("metatag.runtime")); //$NON-NLS-1$ details1Panel.add(lblRuntime, "8, 12, right, default"); } { spRuntime = new JSpinner(); details1Panel.add(spRuntime, "10, 12, fill, default"); } { JLabel lblMin = new JLabel(BUNDLE.getString("metatag.minutes")); //$NON-NLS-1$ details1Panel.add(lblMin, "12, 12"); } { JLabel lblRating = new JLabel(BUNDLE.getString("metatag.rating")); //$NON-NLS-1$ details1Panel.add(lblRating, "16, 12, right, default"); } { spRating = new JSpinner(); details1Panel.add(spRating, "18, 12"); } spRating.setModel(new SpinnerNumberModel(movie.getRating(), 0.0, 10.0, 0.1)); { JLabel lblReleaseDate = new JLabel(BUNDLE.getString("metatag.releasedate")); //$NON-NLS-1$ details1Panel.add(lblReleaseDate, "2, 14, right, default"); } { dpReleaseDate = new DatePicker(movie.getReleaseDate()); details1Panel.add(dpReleaseDate, "4, 14"); } { JLabel lblCertification = new JLabel(BUNDLE.getString("metatag.certification")); //$NON-NLS-1$ details1Panel.add(lblCertification, "8, 14, right, default"); } cbCertification = new JComboBox(); details1Panel.add(cbCertification, "10, 14, 3, 1, fill, default"); { JLabel lblTop = new JLabel(BUNDLE.getString("metatag.top250")); //$NON-NLS-1$ details1Panel.add(lblTop, "16, 14, right, default"); } { spTop250 = new JSpinner(); details1Panel.add(spTop250, "18, 14"); } spTop250.setValue(movie.getTop250()); { JLabel lblIds = new JLabel("Ids"); details1Panel.add(lblIds, "2, 16, right, bottom"); } { JScrollPane scrollPaneIds = new JScrollPane(); details1Panel.add(scrollPaneIds, "4, 16, 9, 5, fill, fill"); { tableIds = new MediaIdTable(ids, ScraperType.MOVIE); scrollPaneIds.setViewportView(tableIds); } } { JButton btnAddId = new JButton(""); btnAddId.setAction(new AddIdAction()); btnAddId.setIcon(IconManager.LIST_ADD); btnAddId.setMargin(new Insets(2, 2, 2, 2)); details1Panel.add(btnAddId, "2, 18, right, top"); } { JButton btnRemoveId = new JButton(""); btnRemoveId.setAction(new RemoveIdAction()); btnRemoveId.setIcon(IconManager.LIST_REMOVE); btnRemoveId.setMargin(new Insets(2, 2, 2, 2)); details1Panel.add(btnRemoveId, "2, 20, right, top"); } { JLabel lblSpokenLanguages = new JLabel(BUNDLE.getString("metatag.spokenlanguages")); //$NON-NLS-1$ details1Panel.add(lblSpokenLanguages, "2, 22, right, default"); } { tfSpokenLanguages = new JTextField(); details1Panel.add(tfSpokenLanguages, "4, 22, fill, default"); tfSpokenLanguages.setColumns(10); } { JLabel lblCountry = new JLabel(BUNDLE.getString("metatag.country")); //$NON-NLS-1$ details1Panel.add(lblCountry, "8, 22, right, default"); } { tfCountry = new JTextField(); details1Panel.add(tfCountry, "10, 22, 3, 1, fill, default"); tfCountry.setColumns(10); } { JLabel lblMovieSet = new JLabel(BUNDLE.getString("metatag.movieset")); //$NON-NLS-1$ details1Panel.add(lblMovieSet, "2, 24, right, default"); } { cbMovieSet = new JComboBox(); cbMovieSet.addItem(""); details1Panel.add(cbMovieSet, "4, 24, 9, 1, fill, default"); } { JLabel lblDateAdded = new JLabel(BUNDLE.getString("metatag.dateadded")); //$NON-NLS-1$ details1Panel.add(lblDateAdded, "2, 26, right, default"); } { spDateAdded = new JSpinner(new SpinnerDateModel()); // JSpinner.DateEditor timeEditor = new JSpinner.DateEditor(spDateAdded, // "dd.MM.yyyy HH:mm:ss"); // spDateAdded.setEditor(timeEditor); details1Panel.add(spDateAdded, "4, 26"); } spDateAdded.setValue(movie.getDateAdded()); JLabel lblWatched = new JLabel(BUNDLE.getString("metatag.watched")); //$NON-NLS-1$ details1Panel.add(lblWatched, "8, 26, right, default"); { cbWatched = new JCheckBox(""); details1Panel.add(cbWatched, "10, 26"); } cbWatched.setSelected(movie.isWatched()); lblWatched.setLabelFor(cbWatched); { JLabel lblSourceT = new JLabel(BUNDLE.getString("metatag.source")); //$NON-NLS-1$ details1Panel.add(lblSourceT, "2, 28, right, default"); } { cbSource = new JComboBox(MediaSource.values()); details1Panel.add(cbSource, "4, 28, fill, default"); } cbSource.setSelectedItem(movie.getMediaSource()); { final JLabel lblEditionT = new JLabel(BUNDLE.getString("metatag.edition")); //$NON-NLS-1$ details1Panel.add(lblEditionT, "8, 28, right, default"); } { cbEdition = new JComboBox(MovieEdition.values()); details1Panel.add(cbEdition, "10, 28, 3, 1, fill, default"); } { JLabel lblVideod = new JLabel(BUNDLE.getString("metatag.3d")); //$NON-NLS-1$ details1Panel.add(lblVideod, "16, 28, right, default"); } { chckbxVideo3D = new JCheckBox(""); details1Panel.add(chckbxVideo3D, "18, 28"); } chckbxVideo3D.setSelected(movie.isVideoIn3D()); { JLabel lblPlot = new JLabel(BUNDLE.getString("metatag.plot")); //$NON-NLS-1$ details1Panel.add(lblPlot, "2, 30, right, top"); } { JScrollPane scrollPanePlot = new JScrollPane(); details1Panel.add(scrollPanePlot, "4, 30, 15, 1, fill, fill"); { tpPlot = new JTextPane(); scrollPanePlot.setViewportView(tpPlot); } } { lblFanart = new ImageLabel(); lblFanart.setAlternativeText(BUNDLE.getString("image.notfound.fanart")); //$NON-NLS-1$ lblFanart.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); lblFanart.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { ImageChooserDialog dialog = new ImageChooserDialog(movieToEdit.getIds(), ImageType.FANART, movieList.getDefaultArtworkScrapers(), lblFanart, extrathumbs, extrafanarts, MediaType.MOVIE); dialog.setLocationRelativeTo(MainWindow.getActiveInstance()); dialog.setVisible(true); } }); details1Panel.add(lblFanart, "22, 30, 3, 5, fill, fill"); } lblFanart.setImagePath(movie.getArtworkFilename(MediaFileType.FANART)); { JLabel lblDirector = new JLabel(BUNDLE.getString("metatag.director")); //$NON-NLS-1$ details1Panel.add(lblDirector, "2, 32, right, default"); } { tfDirector = new JTextField(); details1Panel.add(tfDirector, "4, 32, 15, 1, fill, top"); tfDirector.setColumns(10); } { JLabel lblWriter = new JLabel(BUNDLE.getString("metatag.writer")); //$NON-NLS-1$ details1Panel.add(lblWriter, "2, 34, right, default"); } { tfWriter = new JTextField(); details1Panel.add(tfWriter, "4, 34, 15, 1, fill, top"); tfWriter.setColumns(10); } { JLabel lblCompany = new JLabel(BUNDLE.getString("metatag.production")); //$NON-NLS-1$ details1Panel.add(lblCompany, "2, 36, right, top"); } { JScrollPane scrollPaneProduction = new JScrollPane(); details1Panel.add(scrollPaneProduction, "4, 36, 15, 1, fill, fill"); tfProductionCompanies = new JTextPane(); scrollPaneProduction.setViewportView(tfProductionCompanies); } tabbedPane.addTab(BUNDLE.getString("metatag.details"), details1Panel); //$NON-NLS-1$ } /** * DetailsPanel 2 */ { tabbedPane.addTab(BUNDLE.getString("metatag.details2"), details2Panel); //$NON-NLS-1$ details2Panel.setBorder(new EmptyBorder(5, 5, 5, 5)); details2Panel.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(40dlu;default)"), FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("50px:grow"), FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("100px:grow"), FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("fill:default"), FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow(2)"), })); { JLabel lblActors = new JLabel(BUNDLE.getString("metatag.actors")); //$NON-NLS-1$ details2Panel.add(lblActors, "2, 2, right, default"); } { JScrollPane scrollPane = new JScrollPane(); details2Panel.add(scrollPane, "4, 2, 1, 11"); tableActors = new JTable(); tableActors.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE); scrollPane.setViewportView(tableActors); } { JLabel lblProducers = new JLabel(BUNDLE.getString("metatag.producers")); //$NON-NLS-1$ details2Panel.add(lblProducers, "6, 2, right, default"); } { JScrollPane scrollPane = new JScrollPane(); details2Panel.add(scrollPane, "8, 2, 1, 11"); tableProducers = new JTable(); tableProducers.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE); scrollPane.setViewportView(tableProducers); } { JButton btnAddActor = new JButton(BUNDLE.getString("cast.actor.add")); //$NON-NLS-1$ btnAddActor.setMargin(new Insets(2, 2, 2, 2)); btnAddActor.setAction(new AddActorAction()); btnAddActor.setIcon(IconManager.LIST_ADD); details2Panel.add(btnAddActor, "2, 4, right, top"); } { JButton btnAddProducer = new JButton((String) null); btnAddProducer.setMargin(new Insets(2, 2, 2, 2)); btnAddProducer.setAction(new AddProducerAction()); btnAddProducer.setIcon(IconManager.LIST_ADD); details2Panel.add(btnAddProducer, "6, 4, right, top"); } { JButton btnRemoveActor = new JButton(BUNDLE.getString("cast.actor.remove")); //$NON-NLS-1$ btnRemoveActor.setMargin(new Insets(2, 2, 2, 2)); btnRemoveActor.setAction(new RemoveActorAction()); btnRemoveActor.setIcon(IconManager.LIST_REMOVE); details2Panel.add(btnRemoveActor, "2,6, right, top"); } { JButton btnRemoveProducer = new JButton((String) null); btnRemoveProducer.setMargin(new Insets(2, 2, 2, 2)); btnRemoveProducer.setAction(new RemoveProducerAction()); btnRemoveProducer.setIcon(IconManager.LIST_REMOVE); details2Panel.add(btnRemoveProducer, "6, 6, right, top"); } { JButton btnMoveActorUp = new JButton((String) null); btnMoveActorUp.setMargin(new Insets(2, 2, 2, 2)); btnMoveActorUp.setAction(new MoveActorUpAction()); btnMoveActorUp.setIcon(IconManager.ARROW_UP); details2Panel.add(btnMoveActorUp, "2, 8, right, top"); } { JButton btnMoveProducerUp = new JButton((String) null); btnMoveProducerUp.setMargin(new Insets(2, 2, 2, 2)); btnMoveProducerUp.setAction(new MoveProducerUpAction()); btnMoveProducerUp.setIcon(IconManager.ARROW_UP); details2Panel.add(btnMoveProducerUp, "6, 8, right, top"); } { JButton btnMoveActorDown = new JButton((String) null); btnMoveActorDown.setMargin(new Insets(2, 2, 2, 2)); btnMoveActorDown.setAction(new MoveActorDownAction()); btnMoveActorDown.setIcon(IconManager.ARROW_DOWN); details2Panel.add(btnMoveActorDown, "2, 10, right, top"); } { JButton btnMoveProducerDown = new JButton((String) null); btnMoveProducerDown.setMargin(new Insets(2, 2, 2, 2)); btnMoveProducerDown.setAction(new MoveProducerDownAction()); btnMoveProducerDown.setIcon(IconManager.ARROW_DOWN); details2Panel.add(btnMoveProducerDown, "6, 10, right, top"); } { JLabel lblGenres = new JLabel(BUNDLE.getString("metatag.genre")); //$NON-NLS-1$ details2Panel.add(lblGenres, "2, 14, right, default"); } { JScrollPane scrollPaneGenres = new JScrollPane(); details2Panel.add(scrollPaneGenres, "4, 14, 1, 5"); { listGenres = new JList(); scrollPaneGenres.setViewportView(listGenres); } } { JLabel lblTags = new JLabel(BUNDLE.getString("metatag.tags")); //$NON-NLS-1$ details2Panel.add(lblTags, "6, 14, right, default"); } { JScrollPane scrollPaneTags = new JScrollPane(); details2Panel.add(scrollPaneTags, "8, 14, 1, 5"); listTags = new JList(); scrollPaneTags.setViewportView(listTags); } { JButton btnAddGenre = new JButton(""); btnAddGenre.setAction(new AddGenreAction()); btnAddGenre.setIcon(IconManager.LIST_ADD); btnAddGenre.setMargin(new Insets(2, 2, 2, 2)); details2Panel.add(btnAddGenre, "2, 16, right, top"); } { JButton btnAddTag = new JButton(""); btnAddTag.setAction(new AddTagAction()); btnAddTag.setIcon(IconManager.LIST_ADD); btnAddTag.setMargin(new Insets(2, 2, 2, 2)); details2Panel.add(btnAddTag, "6, 16, right, top"); } { JButton btnRemoveGenre = new JButton(""); btnRemoveGenre.setAction(new RemoveGenreAction()); btnRemoveGenre.setMargin(new Insets(2, 2, 2, 2)); btnRemoveGenre.setIcon(IconManager.LIST_REMOVE); details2Panel.add(btnRemoveGenre, "2, 18, right, top"); } { JButton btnRemoveTag = new JButton(""); btnRemoveTag.setAction(new RemoveTagAction()); btnRemoveTag.setIcon(IconManager.LIST_REMOVE); btnRemoveTag.setMargin(new Insets(2, 2, 2, 2)); details2Panel.add(btnRemoveTag, "6, 18, right, top"); } { cbGenres = new AutocompleteComboBox(MediaGenres.values()); details2Panel.add(cbGenres, "4, 20"); } { cbTags = new AutocompleteComboBox(movieList.getTagsInMovies()); details2Panel.add(cbTags, "8, 20"); } { JLabel lblTrailer = new JLabel(BUNDLE.getString("metatag.trailer")); //$NON-NLS-1$ details2Panel.add(lblTrailer, "2, 22, right, default"); } { JScrollPane scrollPaneTrailer = new JScrollPane(); details2Panel.add(scrollPaneTrailer, "4, 22, 5, 5"); tableTrailer = new JTable(); tableTrailer.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE); scrollPaneTrailer.setViewportView(tableTrailer); } { JButton btnAddTrailer = new JButton(""); btnAddTrailer.setAction(new AddTrailerAction()); btnAddTrailer.setIcon(IconManager.LIST_ADD); btnAddTrailer.setMargin(new Insets(2, 2, 2, 2)); details2Panel.add(btnAddTrailer, "2, 24, right, top"); } { JButton btnRemoveTrailer = new JButton(""); btnRemoveTrailer.setAction(new RemoveTrailerAction()); btnRemoveTrailer.setIcon(IconManager.LIST_REMOVE); btnRemoveTrailer.setMargin(new Insets(2, 2, 2, 2)); details2Panel.add(btnRemoveTrailer, "2, 26, right, top"); } } /** * extra artwork pane */ { JPanel artworkPanel = new JPanel(); tabbedPane.addTab(BUNDLE.getString("metatag.extraartwork"), null, artworkPanel, null); //$NON-NLS-1$ artworkPanel.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("250px:grow"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("250px:grow"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("150px:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("50px:grow(2)"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("50px:grow(2)"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("200px:grow(2)"), FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), })); { JLabel lblLogoT = new JLabel(BUNDLE.getString("mediafiletype.logo")); //$NON-NLS-1$ artworkPanel.add(lblLogoT, "2, 2"); } { lblLogo = new ImageLabel(); lblLogo.setAlternativeText(BUNDLE.getString("image.notfound.logo")); //$NON-NLS-1$ lblLogo.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { ImageChooserDialog dialog = new ImageChooserDialog(movieToEdit.getIds(), ImageType.LOGO, movieList.getDefaultArtworkScrapers(), lblLogo, null, null, MediaType.MOVIE); dialog.setLocationRelativeTo(MainWindow.getActiveInstance()); dialog.setVisible(true); } }); lblLogo.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); artworkPanel.add(lblLogo, "2, 4, fill, fill"); } { final JLabel lblClearlogoT = new JLabel(BUNDLE.getString("mediafiletype.clearlogo")); //$NON-NLS-1$ artworkPanel.add(lblClearlogoT, "4, 2"); } { lblClearlogo = new ImageLabel(); lblClearlogo.setAlternativeText(BUNDLE.getString("image.notfound.clearlogo")); //$NON-NLS-1$ lblClearlogo.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { ImageChooserDialog dialog = new ImageChooserDialog(movieToEdit.getIds(), ImageType.CLEARLOGO, movieList.getDefaultArtworkScrapers(), lblClearlogo, null, null, MediaType.MOVIE); dialog.setLocationRelativeTo(MainWindow.getActiveInstance()); dialog.setVisible(true); } }); lblClearlogo.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); artworkPanel.add(lblClearlogo, "4, 4, fill, fill"); } { JLabel lblBannerT = new JLabel(BUNDLE.getString("mediafiletype.banner")); //$NON-NLS-1$ artworkPanel.add(lblBannerT, "2, 6"); } { lblBanner = new ImageLabel(); lblBanner.setAlternativeText(BUNDLE.getString("image.notfound.banner")); //$NON-NLS-1$ lblBanner.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { ImageChooserDialog dialog = new ImageChooserDialog(movieToEdit.getIds(), ImageType.BANNER, movieList.getDefaultArtworkScrapers(), lblBanner, null, null, MediaType.MOVIE); dialog.setLocationRelativeTo(MainWindow.getActiveInstance()); dialog.setVisible(true); } }); lblBanner.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); artworkPanel.add(lblBanner, "2, 8, 3, 1, fill, fill"); } { JLabel lblClearartT = new JLabel("ClearArt"); artworkPanel.add(lblClearartT, "2, 10"); } { lblClearart = new ImageLabel(); lblClearart.setAlternativeText(BUNDLE.getString("image.notfound.clearart")); //$NON-NLS-1$ lblClearart.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { ImageChooserDialog dialog = new ImageChooserDialog(movieToEdit.getIds(), ImageType.CLEARART, movieList.getDefaultArtworkScrapers(), lblClearart, null, null, MediaType.MOVIE); dialog.setLocationRelativeTo(MainWindow.getActiveInstance()); dialog.setVisible(true); } }); lblClearart.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); artworkPanel.add(lblClearart, "2, 12, fill, fill"); } { JLabel lblThumbT = new JLabel("Thumb"); artworkPanel.add(lblThumbT, "4, 10"); } { lblThumb = new ImageLabel(); lblThumb.setAlternativeText(BUNDLE.getString("image.notfound.thumb")); //$NON-NLS-1$ lblThumb.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { ImageChooserDialog dialog = new ImageChooserDialog(movieToEdit.getIds(), ImageType.THUMB, movieList.getDefaultArtworkScrapers(), lblThumb, null, null, MediaType.MOVIE); dialog.setLocationRelativeTo(MainWindow.getActiveInstance()); dialog.setVisible(true); } }); lblThumb.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); artworkPanel.add(lblThumb, "4, 12, fill, fill"); } { JLabel lblDiscT = new JLabel("Disc"); artworkPanel.add(lblDiscT, "6, 10"); } { lblDisc = new ImageLabel(); lblDisc.setAlternativeText(BUNDLE.getString("image.notfound.disc")); //$NON-NLS-1$ lblDisc.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { ImageChooserDialog dialog = new ImageChooserDialog(movieToEdit.getIds(), ImageType.DISC, movieList.getDefaultArtworkScrapers(), lblDisc, null, null, MediaType.MOVIE); dialog.setLocationRelativeTo(MainWindow.getActiveInstance()); dialog.setVisible(true); } }); lblDisc.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); artworkPanel.add(lblDisc, "6, 12, fill, fill"); } } /** * Media Files */ { mediaFilesPanel = new MediaFileEditorPanel(mediaFiles); tabbedPane.addTab(BUNDLE.getString("metatag.mediafiles"), null, mediaFilesPanel, null); //$NON-NLS-1$ } /** * Button pane */ { JPanel bottomPane = new JPanel(); getContentPane().add(bottomPane, BorderLayout.SOUTH); bottomPane.setLayout(new FormLayout( new ColumnSpec[] { ColumnSpec.decode("371px:grow"), FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, })); JPanel buttonPane = new JPanel(); bottomPane.add(buttonPane, "2, 2, left, top"); EqualsLayout layout = new EqualsLayout(5); layout.setMinWidth(100); buttonPane.setLayout(layout); { JButton okButton = new JButton(BUNDLE.getString("Button.ok")); //$NON-NLS-1$ buttonPane.add(okButton, "2, 1, fill, top"); okButton.setAction(new ChangeMovieAction()); okButton.setActionCommand("OK"); getRootPane().setDefaultButton(okButton); } { JButton cancelButton = new JButton(BUNDLE.getString("Button.cancel")); //$NON-NLS-1$ buttonPane.add(cancelButton, "4, 1, fill, top"); cancelButton.setAction(new DiscardAction()); cancelButton.setActionCommand("Cancel"); } if (inQueue) { JButton btnAbort = new JButton(BUNDLE.getString("Button.abortqueue")); //$NON-NLS-1$ btnAbort.setAction(new AbortQueueAction()); buttonPane.add(btnAbort, "6, 1, fill, top"); } } initDataBindings(); { int year = 0; try { year = Integer.parseInt(movieToEdit.getYear()); } catch (Exception ignored) { } SimpleDateFormat dateFormat = (SimpleDateFormat) DateFormat.getDateInstance(DateFormat.MEDIUM); for (Certification cert : Certification .getCertificationsforCountry(MovieModuleManager.MOVIE_SETTINGS.getCertificationCountry())) { cbCertification.addItem(cert); } tfTitle.setText(movieToEdit.getTitle()); tfOriginalTitle.setText(movieToEdit.getOriginalTitle()); tfSorttitle.setText(movieToEdit.getSortTitle()); tpTagline.setText(movieToEdit.getTagline()); tpPlot.setText(movieToEdit.getPlot()); tpPlot.setCaretPosition(0); tfDirector.setText(movieToEdit.getDirector()); tfWriter.setText(movieToEdit.getWriter()); lblPoster.setImagePath(movieToEdit.getArtworkFilename(MediaFileType.POSTER)); tfProductionCompanies.setText(movieToEdit.getProductionCompany()); spRuntime.setValue(movieToEdit.getRuntime()); cbEdition.setSelectedItem(movieToEdit.getEdition()); tfSpokenLanguages.setText(movieToEdit.getSpokenLanguages()); tfCountry.setText(movieToEdit.getCountry()); spYear.setValue(year); cbCertification.setSelectedItem(movieToEdit.getCertification()); lblMoviePath.setText(movieToEdit.getPath()); lblLogo.setImagePath(movieToEdit.getArtworkFilename(MediaFileType.LOGO)); lblClearlogo.setImagePath(movieToEdit.getArtworkFilename(MediaFileType.CLEARLOGO)); lblClearart.setImagePath(movieToEdit.getArtworkFilename(MediaFileType.CLEARART)); lblThumb.setImagePath(movieToEdit.getArtworkFilename(MediaFileType.THUMB)); lblDisc.setImagePath(movieToEdit.getArtworkFilename(MediaFileType.DISCART)); lblBanner.setImagePath(movieToEdit.getArtworkFilename(MediaFileType.BANNER)); for (MovieActor origCast : movieToEdit.getActors()) { MovieActor actor = new MovieActor(); actor.setName(origCast.getName()); actor.setCharacter(origCast.getCharacter()); actor.setThumbUrl(origCast.getThumbUrl()); cast.add(actor); } for (MovieProducer origProducer : movieToEdit.getProducers()) { MovieProducer producer = new MovieProducer(); producer.setName(origProducer.getName()); producer.setRole(origProducer.getRole()); producer.setThumbUrl(origProducer.getThumbUrl()); producers.add(producer); } for (MediaGenres genre : movieToEdit.getGenres()) { genres.add(genre); } for (MovieTrailer trailer : movieToEdit.getTrailer()) { trailers.add(trailer); } for (String tag : movieToEdit.getTags()) { if (StringUtils.isNotBlank(tag)) { tags.add(tag); } } extrathumbs.addAll(movieToEdit.getExtraThumbs()); extrafanarts.addAll(movieToEdit.getExtraFanarts()); for (MovieSet movieSet : movieList.getSortedMovieSetList()) { cbMovieSet.addItem(movieSet); if (movieToEdit.getMovieSet() == movieSet) { cbMovieSet.setSelectedItem(movieSet); } } } // adjust columnn titles - we have to do it this way - thx to windowbuilder pro tableActors.getColumnModel().getColumn(0).setHeaderValue(BUNDLE.getString("metatag.name")); //$NON-NLS-1$ tableActors.getColumnModel().getColumn(1).setHeaderValue(BUNDLE.getString("metatag.role")); //$NON-NLS-1$ tableProducers.getColumnModel().getColumn(0).setHeaderValue(BUNDLE.getString("metatag.name")); //$NON-NLS-1$ tableProducers.getColumnModel().getColumn(1).setHeaderValue(BUNDLE.getString("metatag.role")); //$NON-NLS-1$ tableTrailer.getColumnModel().getColumn(0).setHeaderValue(BUNDLE.getString("metatag.nfo")); //$NON-NLS-1$ tableTrailer.getColumnModel().getColumn(1).setHeaderValue(BUNDLE.getString("metatag.name")); //$NON-NLS-1$ tableTrailer.getColumnModel().getColumn(2).setHeaderValue(BUNDLE.getString("metatag.source")); //$NON-NLS-1$ tableTrailer.getColumnModel().getColumn(3).setHeaderValue(BUNDLE.getString("metatag.quality")); //$NON-NLS-1$ tableTrailer.getColumnModel().getColumn(4).setHeaderValue(BUNDLE.getString("metatag.url")); //$NON-NLS-1$ // adjust table columns tableTrailer.getColumnModel().getColumn(0).setMaxWidth(55); // implement listener to simulate button group tableTrailer.getModel().addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent arg0) { // click on the checkbox if (arg0.getColumn() == 0) { int row = arg0.getFirstRow(); MovieTrailer changedTrailer = trailers.get(row); // if flag inNFO was changed, change all other trailers flags if (changedTrailer.getInNfo()) { for (MovieTrailer trailer : trailers) { if (trailer != changedTrailer) { trailer.setInNfo(Boolean.FALSE); } } } } } }); }