List of usage examples for javax.swing JScrollPane setBorder
@BeanProperty(preferred = true, visualUpdate = true, description = "The component's border.") public void setBorder(Border border)
From source file:org.ops4j.pax.idea.runner.forms.OsgiConfigEditorForm.java
/** * Method generated by IntelliJ IDEA GUI Designer * >>> IMPORTANT!! <<< * DO NOT edit this method OR call it in your code! * * @noinspection HardCodedStringLiteral/*w w w. j ava 2s .co m*/ */ private void $$$setupUI$$$() { m_mainPanel = new JPanel(); m_mainPanel.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); final JPanel panel1 = new JPanel(); panel1.setLayout(new GridLayoutManager(7, 1, new Insets(0, 0, 0, 0), -1, -1)); m_mainPanel.add(panel1, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JPanel panel2 = new JPanel(); panel2.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); panel1.add(panel2, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); panel2.setBorder(BorderFactory.createTitledBorder("Platform")); final JScrollPane scrollPane1 = new JScrollPane(); panel2.add(scrollPane1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); m_platforms = new JList(); scrollPane1.setViewportView(m_platforms); final JPanel panel3 = new JPanel(); panel3.setLayout(new GridLayoutManager(3, 1, new Insets(0, 0, 0, 0), -1, -1)); panel1.add(panel3, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); panel3.setBorder(BorderFactory.createTitledBorder("Options")); m_startGui = new JCheckBox(); m_startGui.setText("Start GUI"); panel3.add(m_startGui, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); m_runClean = new JCheckBox(); m_runClean.setText("Run Clean"); panel3.add(m_runClean, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JScrollPane scrollPane2 = new JScrollPane(); panel1.add(scrollPane2, new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); scrollPane2.setBorder(BorderFactory.createTitledBorder("System Properties")); m_systemProperties = new JTable(); m_systemProperties.setEnabled(true); scrollPane2.setViewportView(m_systemProperties); final JPanel panel4 = new JPanel(); panel4.setLayout(new GridLayoutManager(4, 2, new Insets(0, 0, 0, 0), -1, -1)); panel1.add(panel4, new GridConstraints(6, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); panel4.setBorder(BorderFactory.createTitledBorder("Proxy")); final JLabel label1 = new JLabel(); label1.setText("Port:"); panel4.add(label1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label2 = new JLabel(); label2.setText("Username:"); panel4.add(label2, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label3 = new JLabel(); label3.setText("Password:"); panel4.add(label3, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); m_proxyHost = new JTextField(); panel4.add(m_proxyHost, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); m_proxyPort = new JTextField(); panel4.add(m_proxyPort, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); m_proxyUser = new JTextField(); panel4.add(m_proxyUser, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); m_proxyPass = new JPasswordField(); panel4.add(m_proxyPass, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); final JLabel label4 = new JLabel(); label4.setHorizontalAlignment(10); label4.setHorizontalTextPosition(10); label4.setText("Host:"); panel4.add(label4, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel5 = new JPanel(); panel5.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1)); panel1.add(panel5, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label5 = new JLabel(); label5.setText("Working Dir:"); panel5.add(label5, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); m_workDir = new JTextField(); panel5.add(m_workDir, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); m_selectDir = new JButton(); m_selectDir.setText("..."); panel5.add(m_selectDir, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel6 = new JPanel(); panel6.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); panel1.add(panel6, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label6 = new JLabel(); label6.setText("VM Arguments:"); panel6.add(label6, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); m_vmArguments = new JTextField(); panel6.add(m_vmArguments, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); final JPanel panel7 = new JPanel(); panel7.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1)); panel1.add(panel7, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label7 = new JLabel(); label7.setText("JDK:"); panel7.add(label7, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); m_jdk = new JTextField(); m_jdk.setEditable(false); panel7.add(m_jdk, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); final JPanel panel8 = new JPanel(); panel8.setLayout(new GridLayoutManager(4, 1, new Insets(0, 0, 0, 0), -1, -1)); m_mainPanel.add(panel8, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); panel8.setBorder(BorderFactory.createTitledBorder("Bundles")); final JPanel panel9 = new JPanel(); panel9.setLayout(new GridLayoutManager(1, 5, new Insets(0, 0, 0, 0), -1, -1)); panel8.add(panel9, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); JButton add = new JButton(); add.setText("Add..."); panel9.add(add, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JScrollPane scrollPane3 = new JScrollPane(); panel8.add(scrollPane3, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); scrollPane3.setBorder(BorderFactory.createTitledBorder("Properties")); m_bundleProperties = new JTable(); scrollPane3.setViewportView(m_bundleProperties); final JScrollPane scrollPane4 = new JScrollPane(); panel8.add(scrollPane4, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); m_bundles = new JList(); scrollPane4.setViewportView(m_bundles); final JPanel panel10 = new JPanel(); panel10.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); panel8.add(panel10, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); panel10.setBorder(BorderFactory.createTitledBorder("Description")); m_description = new JTextArea(); panel10.add(m_description, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_WANT_GROW, null, new Dimension(150, 50), null, 0, false)); }
From source file:org.photovault.swingui.PhotoInfoEditor.java
protected void createUI() { setLayout(new BorderLayout()); setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); tabPane = new JTabbedPane(); add(tabPane, BorderLayout.CENTER); // General pane JPanel generalPane = new JPanel(); tabPane.addTab("General", generalPane); // Create the fields & their labels // Photographer field JLabel photographerLabel = new JLabel("Photographer"); photographerField = createMvTextField("photographer", 30); photographerDoc = photographerField.getDocument(); // "Fuzzy time" field JLabel fuzzyDateLabel = new JLabel("Shooting date"); fuzzyDateField = new JTextField(30); fuzzyDateDoc = fuzzyDateField.getDocument(); fuzzyDateDoc.putProperty(FIELD, PhotoInfoFields.FUZZY_SHOOT_TIME); fuzzyDateDoc.addDocumentListener(this); JLabel qualityLabel = new JLabel("Quality"); qualityField = new JComboBox(qualityStrings); qualityField.addActionListener(this); StarRating qualityStars = new StarRating(5); FieldController<Integer> qfCtrl = ctrl.getFieldController("quality"); ValueModel qualityFieldValue = new PropertyAdapter(qfCtrl, "value", true); ValueModel starCount = new PropertyAdapter(qualityStars, "selection", true); PropertyConnector.connect(qualityFieldValue, "value", starCount, "value"); // Shooting place field JLabel shootingPlaceLabel = new JLabel("Shooting place"); shootingPlaceField = createMvTextField("shotLocation.description", 30); shootingPlaceDoc = shootingPlaceField.getDocument(); JLabel shotLocRoadLabel = new JLabel("Road"); JTextField shotLocRoadField = createMvTextField("shotLocation.road", 30); JLabel shotLocSuburbLabel = new JLabel("Suburb"); JTextField shotLocSuburbField = createMvTextField("shotLocation.suburb", 30); JLabel shotLocCityLabel = new JLabel("City"); JTextField shotLocCityField = createMvTextField("shotLocation.city", 30); JLabel shotLocCountryLabel = new JLabel("Country"); JTextField shotLocCountryField = createMvTextField("shotLocation.country", 30); JLabel shotLocGeohashLabel = new JLabel("Geohash code"); JTextField shotLocGeohashField = createMvTextField("shotLocation.geoHashString", 30); shotLocGeohashField.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0), "fillAddress"); shotLocGeohashField.getActionMap().put("fillAddress", new FindAddressAction(ctrl)); // Tags/* www . j a v a 2 s . c o m*/ JLabel tagLabel = new JLabel("Tags"); tagList = new TagList2(ctrl.getTagController()); tagList.setBackground(generalPane.getBackground()); // Description text JLabel descLabel = new JLabel("Description"); descriptionTextArea = new JTextArea(5, 40); descriptionTextArea.setLineWrap(true); descriptionTextArea.setWrapStyleWord(true); JScrollPane descScrollPane = new JScrollPane(descriptionTextArea); descScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); Border descBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); descBorder = BorderFactory.createTitledBorder(descBorder, "Description"); descScrollPane.setBorder(descBorder); descriptionDoc = descriptionTextArea.getDocument(); descriptionDoc.putProperty(FIELD, PhotoInfoFields.DESCRIPTION); descriptionDoc.addDocumentListener(this); // Lay out the created controls GridBagLayout layout = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); generalPane.setLayout(layout); JLabel[] labels = { photographerLabel, fuzzyDateLabel, shootingPlaceLabel, shotLocGeohashLabel, shotLocRoadLabel, shotLocSuburbLabel, shotLocCityLabel, shotLocCountryLabel, qualityLabel, tagLabel }; JComponent[] fields = { photographerField, fuzzyDateField, shootingPlaceField, shotLocGeohashField, shotLocRoadField, shotLocSuburbField, shotLocCityField, shotLocCountryField, qualityStars, tagList }; addLabelTextRows(labels, fields, layout, generalPane); c = layout.getConstraints(tagList); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0.0; c.weighty = 1.0; layout.setConstraints(tagList, c); generalPane.add(descScrollPane); c.gridwidth = GridBagConstraints.REMAINDER; c.weighty = 0.5; c.fill = GridBagConstraints.BOTH; layout.setConstraints(descScrollPane, c); c = new GridBagConstraints(); c.gridwidth = 1; c.weighty = 0; c.fill = GridBagConstraints.NONE; c.gridy = GridBagConstraints.RELATIVE; c.gridy = GridBagConstraints.RELATIVE; createTechDataUI(); createFolderPaneUI(); createRightsUI(); }
From source file:org.photovault.swingui.PhotoInfoEditor.java
protected void createTechDataUI() { JPanel pane = new JPanel(); tabPane.addTab("Tech data", pane); JLabel cameraMakerLabel = new JLabel("Camera make"); JTextField cameraMakerField = createMvTextField("cameraMaker", 20); // cameraDoc = cameraField.getDocument(); JLabel cameraLabel = new JLabel("Camera model"); cameraField = createMvTextField("camera", 20); cameraDoc = cameraField.getDocument(); JLabel lensLabel = new JLabel("Lens"); lensField = createMvTextField("lens", 20); lensDoc = lensField.getDocument();// w ww. j a va2 s .co m JLabel filmLabel = new JLabel("Film"); filmField = createMvTextField("film", 20); filmDoc = filmField.getDocument(); JLabel filmSpeedLabel = new JLabel("Film speed"); NumberFormatter filmSpeedFormatter = new NumberFormatter(new DecimalFormat("#########0")); filmSpeedFormatter.setValueClass(PhotoInfoFields.FILM_SPEED.getType()); filmSpeedField = new JFormattedTextField(filmSpeedFormatter); filmSpeedField.setColumns(5); filmSpeedField.addPropertyChangeListener(this); filmSpeedField.putClientProperty(FIELD, PhotoInfoFields.FILM_SPEED); JLabel shutterSpeedLabel = new JLabel("Shutter speed"); DecimalFormat shutterSpeedFormat = new DecimalFormat("###0.####"); NumberFormatter shutterSpeedFormatter = new NumberFormatter(shutterSpeedFormat); shutterSpeedFormatter.setValueClass(PhotoInfoFields.SHUTTER_SPEED.getType()); shutterSpeedField = new JFormattedTextField(shutterSpeedFormatter); shutterSpeedField.setColumns(5); shutterSpeedField.addPropertyChangeListener(this); shutterSpeedField.putClientProperty(FIELD, PhotoInfoFields.SHUTTER_SPEED); JLabel fStopLabel = new JLabel("F-stop"); DecimalFormat fStopFormat = new DecimalFormat("#0.#"); NumberFormatter fStopFormatter = new NumberFormatter(fStopFormat); fStopFormatter.setValueClass(PhotoInfoFields.FSTOP.getType()); fStopField = new JFormattedTextField(fStopFormatter); fStopField.setColumns(5); fStopField.addPropertyChangeListener(this); fStopField.putClientProperty(FIELD, PhotoInfoFields.FSTOP); JLabel focalLengthLabel = new JLabel("Focal length"); NumberFormatter focalLengthFormatter = new NumberFormatter(new DecimalFormat("#######0.#")); focalLengthFormatter.setValueClass(PhotoInfoFields.FSTOP.getType()); focalLengthField = new JFormattedTextField(focalLengthFormatter); focalLengthField.setColumns(5); focalLengthField.addPropertyChangeListener(this); focalLengthField.putClientProperty(FIELD, PhotoInfoFields.FOCAL_LENGTH); // Tech note text JLabel notesLabel = new JLabel("Tech. notes"); technoteTextArea = new JTextArea(5, 40); technoteTextArea.setLineWrap(true); technoteTextArea.setWrapStyleWord(true); JScrollPane technoteScrollPane = new JScrollPane(technoteTextArea); technoteScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); Border technoteBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); technoteBorder = BorderFactory.createTitledBorder(technoteBorder, "Description"); technoteScrollPane.setBorder(technoteBorder); technoteDoc = technoteTextArea.getDocument(); technoteDoc.putProperty(FIELD, PhotoInfoFields.TECH_NOTES); technoteDoc.addDocumentListener(this); // Lay out the created controls GridBagLayout layout = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); pane.setLayout(layout); JLabel[] labels = { cameraMakerLabel, cameraLabel, lensLabel, focalLengthLabel, filmLabel, filmSpeedLabel, shutterSpeedLabel, fStopLabel }; JTextField[] fields = { cameraMakerField, cameraField, lensField, focalLengthField, filmField, filmSpeedField, shutterSpeedField, fStopField }; addLabelTextRows(labels, fields, layout, pane); pane.add(technoteScrollPane); c.gridwidth = GridBagConstraints.REMAINDER; c.weighty = 0.5; c.fill = GridBagConstraints.BOTH; layout.setConstraints(technoteScrollPane, c); }
From source file:org.photovault.swingui.PhotoInfoEditor.java
private void createRightsUI() { JPanel pane = new JPanel(); tabPane.addTab("Rights", pane); JLabel copyrightLabel = new JLabel("Copyright"); JTextField copyrightField = createMvTextField("usageRights.copyright", 30); JLabel attributionLabel = new JLabel("Name for attribution"); JTextField attributionField = createMvTextField("usageRights.attributionName", 30); JLabel attributionUrlLabel = new JLabel("Url for attribution"); JTextField attributionUrlField = createMvTextField("usageRights.attributionUrl", 30); JLabel licenseLabel = new JLabel("License"); List<License> licenses = new ArrayList(); licenses.addAll(EnumSet.allOf(License.class)); JComboBox licenseCombo = createMvComboBox("usageRights.license", licenses); // Tech note text JLabel termsLabel = new JLabel("Usage terms"); JTextArea termsTextArea = createMvTextArea("usageRights.usageTerms", 5, 40); termsTextArea.setLineWrap(true);// w w w .j a v a 2s . co m termsTextArea.setWrapStyleWord(true); JScrollPane termsScrollPane = new JScrollPane(termsTextArea); termsScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); Border termsBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); termsBorder = BorderFactory.createTitledBorder(termsBorder, "Usage terms"); termsScrollPane.setBorder(termsBorder); GridBagLayout layout = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); pane.setLayout(layout); JLabel[] labels = { copyrightLabel, licenseLabel, attributionLabel, attributionUrlLabel }; JComponent[] fields = { copyrightField, licenseCombo, attributionField, attributionUrlField }; addLabelTextRows(labels, fields, layout, pane); pane.add(termsScrollPane); c.gridwidth = GridBagConstraints.REMAINDER; c.weighty = 0.5; c.fill = GridBagConstraints.BOTH; layout.setConstraints(termsScrollPane, c); }
From source file:org.p_vcd.ui.VcdDialog.java
public VcdDialog() { setSize(700, 450);//from www . ja v a 2 s . c o m setTitle("P-VCD - Video Copy Detection"); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); this.currentStep = 1; getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); contentPanel.setLayout(new CardLayout(0, 0)); { JPanel panel_Step1 = new JPanel(); contentPanel.add(panel_Step1, "card_step1"); panel_Step1.setLayout(new BorderLayout(0, 0)); JLabel lblTitle = new JLabel("STEP 1 - Video Database (the \"known\")"); panel_Step1.add(lblTitle, BorderLayout.NORTH); lblTitle.setHorizontalAlignment(SwingConstants.CENTER); lblTitle.setFont(new Font("Tahoma", Font.PLAIN, 18)); JPanel panel_1 = new JPanel(); panel_Step1.add(panel_1, BorderLayout.CENTER); panel_1.setLayout(new MigLayout("", "[250px,grow][20px][250px,grow]", "[][][230px,grow][][][]")); JLabel lblNewLabel = new JLabel("Please select the video databases to search in:"); panel_1.add(lblNewLabel, "cell 0 0"); panel_1.add(lbl_refDbTitle, "cell 2 1"); JScrollPane scrollPane_1 = new JScrollPane(); panel_1.add(scrollPane_1, "cell 0 1 1 3,grow"); panel_refDatabasesList.setBackground(Color.WHITE); scrollPane_1.setViewportView(panel_refDatabasesList); panel_refDatabasesList.setLayout(new MigLayout("gapy 10", "[200px]", "[][]")); JScrollPane scrollPane = new JScrollPane(); scrollPane.setBorder(null); panel_1.add(scrollPane, "cell 2 2,grow"); scrollPane.setViewportView(lbl_refDbFiles); panel_1.add(lbl_refDbMetadata, "cell 2 3"); JButton btnNewDatabase = new JButton("New database..."); panel_1.add(btnNewDatabase, "cell 0 4"); btnNewDatabase.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { newDatabaseButton(); } }); } { JPanel panel_Step2 = new JPanel(); contentPanel.add(panel_Step2, "card_step2"); panel_Step2.setLayout(new BorderLayout(0, 0)); JLabel lblTitle = new JLabel("STEP 2 - Query (the \"unknown\")"); panel_Step2.add(lblTitle, BorderLayout.NORTH); lblTitle.setHorizontalAlignment(SwingConstants.CENTER); lblTitle.setFont(new Font("Tahoma", Font.PLAIN, 18)); JPanel panel = new JPanel(); panel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Query", TitledBorder.LEADING, TitledBorder.TOP, null, null)); panel_Step2.add(panel, BorderLayout.CENTER); panel.setLayout( new MigLayout("", "[160px][grow]", "[25px][grow,top][25px][grow,top][25px][grow,top][grow]")); ButtonGroup queryButtonGroup = new ButtonGroup(); queryButtonGroup.add(radio_queryFile); radio_queryFile.setFont(new Font("Tahoma", Font.PLAIN, 13)); panel.add(radio_queryFile, "cell 0 0"); lbl_queryFile.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { radio_queryFile.setSelected(true); } }); panel.add(lbl_queryFile, "flowy,cell 1 0"); JButton btnSelectFile = new JButton("Select File..."); btnSelectFile.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { selectFileButton(); } }); panel.add(btnSelectFile, "cell 1 0"); JLabel lblIumageOrVideo = new JLabel("Select an image or video in the local machine."); panel.add(lblIumageOrVideo, "cell 1 1"); queryButtonGroup.add(radio_queryUrl); radio_queryUrl.setFont(new Font("Tahoma", Font.PLAIN, 13)); panel.add(radio_queryUrl, "cell 0 2"); txt_queryUrl.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { radio_queryUrl.setSelected(true); } }); txt_queryUrl.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { radio_queryUrl.setSelected(true); } }); txt_queryUrl.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { radio_queryUrl.setSelected(true); } }); txt_queryUrl.setText("http://"); panel.add(txt_queryUrl, "flowy,cell 1 2"); txt_queryUrl.setColumns(50); JLabel lblUrlToA = new JLabel( "<html>Enter the URL to download an image or video.<br>You can use a URL like: http://www.youtube.com/watch?v=... </html>"); panel.add(lblUrlToA, "flowy,cell 1 3"); queryButtonGroup.add(radio_queryDb); radio_queryDb.setFont(new Font("Tahoma", Font.PLAIN, 13)); panel.add(radio_queryDb, "cell 0 4"); comboBox_queryDb.setMaximumRowCount(12); comboBox_queryDb.setPreferredSize(new Dimension(100, 20)); comboBox_queryDb.setMinimumSize(new Dimension(100, 20)); comboBox_queryDb.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if (comboBox_queryDb.getSelectedIndex() > 0) radio_queryDb.setSelected(true); updateQueryDbDetail(); } }); comboBox_queryDb.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { if (comboBox_queryDb.getSelectedIndex() > 0) radio_queryDb.setSelected(true); updateQueryDbDetail(); } }); panel.add(comboBox_queryDb, "flowx,cell 1 4"); panel.add(lbl_queryDb, "cell 1 4"); JLabel lblPleaseNopteThe = new JLabel("<html>A search is run for each video in the database.</html>"); panel.add(lblPleaseNopteThe, "cell 1 5"); } { JPanel panel_Step3 = new JPanel(); contentPanel.add(panel_Step3, "card_step3"); panel_Step3.setLayout(new BorderLayout(0, 0)); JLabel lblTitle = new JLabel("STEP 3 - Search Options"); lblTitle.setFont(new Font("Tahoma", Font.PLAIN, 18)); lblTitle.setHorizontalAlignment(SwingConstants.CENTER); panel_Step3.add(lblTitle, BorderLayout.NORTH); JPanel panel2 = new JPanel(); panel2.setLayout(new FlowLayout()); panel_Step3.add(panel2, BorderLayout.CENTER); JPanel panel = new JPanel(); panel2.add(panel); panel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Basic Options", TitledBorder.LEADING, TitledBorder.TOP, null, null)); panel.setLayout(new MigLayout("gapy 5px", "[30px][101px]", "[][][][][][][20px]")); ButtonGroup buttonGroup = new ButtonGroup(); buttonGroup.add(radio_searchByGlobal); radio_searchByGlobal.setFont(new Font("Tahoma", Font.PLAIN, 13)); radio_searchByGlobal.setSelected(true); panel.add(radio_searchByGlobal, "cell 0 0 2 1,alignx left,aligny top"); JLabel lblNewLabel_2 = new JLabel( "Detects most of the copies that are visually alike to the original."); panel.add(lblNewLabel_2, "cell 1 1"); JButton btnOptions = new JButton("Advanced Options..."); btnOptions.setEnabled(false); panel.add(btnOptions, "cell 1 2"); buttonGroup.add(radio_searchByLocal); radio_searchByLocal.setFont(new Font("Tahoma", Font.PLAIN, 13)); panel.add(radio_searchByLocal, "cell 0 4 2 1,alignx left,aligny top"); JLabel lblNewLabel_3 = new JLabel( "Requires more resources (disk space, search time, memory) but can detect more copies."); panel.add(lblNewLabel_3, "cell 1 5"); JButton btnOptions_1 = new JButton("Advanced Options..."); btnOptions_1.setEnabled(false); panel.add(btnOptions_1, "cell 1 6"); } { JPanel panel_Step4 = new JPanel(); contentPanel.add(panel_Step4, "card_step4"); panel_Step4.setLayout(new BorderLayout(0, 0)); JLabel lblTitle = new JLabel("STEP 4 - Search"); lblTitle.setHorizontalAlignment(SwingConstants.CENTER); lblTitle.setFont(new Font("Tahoma", Font.PLAIN, 18)); panel_Step4.add(lblTitle, BorderLayout.NORTH); JScrollPane scrollPane = new JScrollPane(); panel_Step4.add(scrollPane, BorderLayout.CENTER); textConsole.setFont(new Font("Monospaced", Font.PLAIN, 11)); textConsole.setForeground(Color.WHITE); textConsole.setBackground(Color.BLACK); textConsole.setEditable(false); textConsole.setCursor(new Cursor(Cursor.TEXT_CURSOR)); textConsole.setText( "Press 'Next' button to start the search...\nNote: Depending on the selected options, the search may take up to several hours."); scrollPane.setViewportView(textConsole); JPanel panel = new JPanel(); panel_Step4.add(panel, BorderLayout.SOUTH); panel.setLayout(new GridLayout(0, 1, 0, 0)); JSeparator separator = new JSeparator(); separator.setPreferredSize(new Dimension(0, 1)); panel.add(separator); progressBar.setStringPainted(true); progressBar.setPreferredSize(new Dimension(350, 20)); panel.add(progressBar); lblProgress.setHorizontalAlignment(SwingConstants.CENTER); lblProgress.setFont(new Font("Tahoma", Font.PLAIN, 14)); panel.add(lblProgress); } { JPanel panel_Step5 = new JPanel(); contentPanel.add(panel_Step5, "card_step5"); panel_Step5.setLayout(new BorderLayout(0, 0)); JLabel lblTitle = new JLabel("STEP 5 - Results"); lblTitle.setHorizontalAlignment(SwingConstants.CENTER); lblTitle.setFont(new Font("Tahoma", Font.PLAIN, 18)); panel_Step5.add(lblTitle, BorderLayout.NORTH); JScrollPane scrollPane = new JScrollPane(); panel_Step5.add(scrollPane, BorderLayout.CENTER); scrollPane.setViewportView(panelResults); panelResults.setLayout(new MigLayout("gapy 10, gapx 20", "[120px,center][150px,center,grow][150px,center,grow]", "[25px][]")); } { JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane, BorderLayout.SOUTH); { JButton prevButton = new JButton("Previous"); prevButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { previousButton(); } }); prevButton.setActionCommand("Previous"); buttonPane.add(prevButton); } { JButton okButton = new JButton("Next"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { nextButton(); } }); okButton.setActionCommand("OK"); buttonPane.add(okButton); getRootPane().setDefaultButton(okButton); } { JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { cancelButton(); } }); cancelButton.setActionCommand("Cancel"); buttonPane.add(cancelButton); } } this.addWindowListener(new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { closeWindow(); } }); updateDatabases(null); }
From source file:org.rdv.ui.ChannelListPanel.java
/** * Create the channel tree panel./*from ww w .ja v a 2 s . co m*/ * * @return the component containing the channel tree */ private JComponent createTreePanel() { treeModel = new ChannelTreeModel(); treeModel.addPropertyChangeListener(new FilterPropertyChangeListener()); tree = new JTree(treeModel); tree.setRootVisible(false); tree.setShowsRootHandles(true); tree.setExpandsSelectedPaths(true); tree.setCellRenderer(new ChannelTreeCellRenderer()); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); tree.addTreeSelectionListener(new ChannelTreeSelectionListener()); tree.addMouseListener(new ChannelTreeMouseListener()); tree.setBorder(new EmptyBorder(0, 5, 5, 5)); JScrollPane treeView = new JScrollPane(tree); treeView.setBorder(null); treeView.setViewportBorder(null); tree.setDragEnabled(true); tree.setTransferHandler(new ChannelTransferHandler()); DragSource dragSource = DragSource.getDefaultDragSource(); dragSource.createDefaultDragGestureRecognizer(tree, DnDConstants.ACTION_LINK, new ChannelDragGestureListener()); return treeView; }
From source file:org.spoutcraft.launcher.skin.ConsoleFrame.java
/** * Build the interface.//from ww w. jav a 2s. c o m */ private void buildUI() { if (colorEnabled) { JTextPane text = new JTextPane(); this.textComponent = text; } else { JTextArea text = new JTextArea(); this.textComponent = text; text.setLineWrap(true); } textComponent.addMouseListener(this); textComponent.setFont(getMonospaceFont()); textComponent.setEditable(false); DefaultCaret caret = (DefaultCaret) textComponent.getCaret(); caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE); document = textComponent.getDocument(); document.addDocumentListener(new LimitLinesDocumentListener(numLines, true)); JScrollPane scrollText = new JScrollPane(textComponent); scrollText.setBorder(null); scrollText.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); add(scrollText, BorderLayout.CENTER); }
From source file:org.sybila.parasim.extension.projectmanager.view.robustness.RobustnessSettings.java
public RobustnessSettings(RobustnessSettingsModel robustnessModel, OdeSystemNames odeNames) { Validate.notNull(robustnessModel);//from w w w.j ava2 s. c o m Validate.notNull(odeNames); model = robustnessModel; names = odeNames; filterUnvalued(names.getVariables()); filterUnvalued(names.getParameters()); perturbationTable = new JPanel(new GridBagLayout()); perturbationTable.add(TableConstraints.getHeaderLabelWithToolTip("Minimum", "Sampling Interval Minimum"), TableConstraints.getHeaderConstraints(1)); perturbationTable.add(TableConstraints.getHeaderLabelWithToolTip("Maximum", "Sampling Interval Maximum"), TableConstraints.getHeaderConstraints(2)); int y = 1; for (String name : odeNames.getVariables()) { addRow(name, y); y++; } for (String name : odeNames.getParameters()) { addRow(name, y); y++; } JScrollPane perturbationPane = new ScrollPane(perturbationTable); variables = new AnalysisChoiceBox(names.getVariables()); parameters = new AnalysisChoiceBox(names.getParameters()); JScrollPane variablesPane = new ScrollPane(variables); variablesPane.setBorder(new TitledBorder("Variables")); JScrollPane parametersPane = new ScrollPane(parameters); parametersPane.setBorder(new TitledBorder("Parameters")); setLayout(new GridBagLayout()); GridBagConstraints constraints = getConstraints(); constraints.gridx = 0; constraints.gridy = 0; constraints.gridwidth = 2; add(perturbationPane, constraints); constraints = getConstraints(); constraints.gridx = 0; constraints.gridy = 1; add(variablesPane, constraints); constraints = getConstraints(); constraints.gridx = 1; constraints.gridy = 1; add(parametersPane, constraints); setValues(names.getDefaultRobustnessSettingsValues()); }
From source file:org.tinymediamanager.ui.movies.settings.MovieSubtitleSettingsPanel.java
private void initComponents() { // data init//w w w.j a v a 2 s . c o m List<String> enabledSubtitleProviders = settings.getMovieSubtitleScrapers(); int selectedIndex = -1; int counter = 0; for (MediaScraper scraper : MovieList.getInstance().getAvailableSubtitleScrapers()) { SubtitleScraper subtitleScraper = new SubtitleScraper(scraper); if (enabledSubtitleProviders.contains(subtitleScraper.getScraperId())) { subtitleScraper.active = true; if (selectedIndex < 0) { selectedIndex = counter; } } scrapers.add(subtitleScraper); counter++; } // UI init setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, })); JPanel panelSubtitleScrapers = new JPanel(); panelSubtitleScrapers.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), BUNDLE.getString("scraper.subtitle"), TitledBorder.LEADING, TitledBorder.TOP, null, null)); // $NON-NLS-1$ add(panelSubtitleScrapers, "2, 2, 5, 1, fill, fill"); panelSubtitleScrapers.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("100dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("200dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("100dlu:grow"), })); final JScrollPane scrollPaneScraperDetails = new JScrollPane(); scrollPaneScraperDetails.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPaneScraperDetails.setBorder(null); panelSubtitleScrapers.add(scrollPaneScraperDetails, "4, 1, 1, 2, fill, fill"); JPanel panelScraperDetails = new JPanel(); scrollPaneScraperDetails.setViewportView(panelScraperDetails); panelScraperDetails.setLayout(new FormLayout(new ColumnSpec[] { ColumnSpec.decode("default:grow"), }, new RowSpec[] { RowSpec.decode("default:grow"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, })); { // add a CSS rule to force body tags to use the default label font // instead of the value in javax.swing.text.html.default.csss Font font = UIManager.getFont("Label.font"); String bodyRule = "body { font-family: " + font.getFamily() + "; " + "font-size: " + font.getSize() + "pt; }"; tpScraperDescription = new JTextPane(); tpScraperDescription.setOpaque(false); tpScraperDescription.setEditorKit(new HTMLEditorKit()); ((HTMLDocument) tpScraperDescription.getDocument()).getStyleSheet().addRule(bodyRule); panelScraperDetails.add(tpScraperDescription, "1, 1, fill, top"); } panelScraperOptions = new ScrollablePanel(); panelScraperOptions.setLayout(new FlowLayout(FlowLayout.LEFT)); panelScraperDetails.add(panelScraperOptions, "1, 3, fill, top"); JScrollPane scrollPaneScraper = new JScrollPane(); panelSubtitleScrapers.add(scrollPaneScraper, "2, 2, fill, fill"); tableScraper = new JTable(); tableScraper.setRowHeight(29); scrollPaneScraper.setViewportView(tableScraper); final JLabel lblScraperLanguage = new JLabel(BUNDLE.getString("Settings.preferredLanguage")); //$NON-NLS-1$ add(lblScraperLanguage, "2, 4, right, default"); cbScraperLanguage = new JComboBox(MediaLanguages.values()); add(cbScraperLanguage, "4, 4, fill, default"); initDataBindings(); // adjust table columns // Checkbox and Logo shall have minimal width TableColumnResizer.setMaxWidthForColumn(tableScraper, 0, 2); TableColumnResizer.setMaxWidthForColumn(tableScraper, 1, 2); TableColumnResizer.adjustColumnPreferredWidths(tableScraper, 5); tableScraper.getModel().addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent arg0) { // click on the checkbox if (arg0.getColumn() == 0) { int row = arg0.getFirstRow(); SubtitleScraper changedScraper = scrapers.get(row); if (changedScraper.active) { settings.addMovieSubtitleScraper(changedScraper.getScraperId()); } else { settings.removeMovieSubtitleScraper(changedScraper.getScraperId()); } } } }); // implement selection listener to load settings tableScraper.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { int index = tableScraper.convertRowIndexToModel(tableScraper.getSelectedRow()); if (index > -1) { panelScraperOptions.removeAll(); if (scrapers.get(index).getMediaProvider().getProviderInfo().getConfig().hasConfig()) { panelScraperOptions .add(new MediaScraperConfigurationPanel(scrapers.get(index).getMediaProvider())); } panelScraperOptions.revalidate(); } } }); // select default movie scraper if (selectedIndex < 0) { selectedIndex = 0; } if (counter > 0) { tableScraper.getSelectionModel().setSelectionInterval(selectedIndex, selectedIndex); } }
From source file:org.tinymediamanager.ui.movies.settings.MovieTrailerSettingsPanel.java
public MovieTrailerSettingsPanel() { // data init// w w w. ja v a2 s. c o m List<String> enabledTrailerProviders = settings.getMovieTrailerScrapers(); int selectedIndex = -1; int counter = 0; for (MediaScraper scraper : MovieList.getInstance().getAvailableTrailerScrapers()) { TrailerScraper trailerScraper = new TrailerScraper(scraper); if (enabledTrailerProviders.contains(trailerScraper.getScraperId())) { trailerScraper.active = true; if (selectedIndex < 0) { selectedIndex = counter; } } scrapers.add(trailerScraper); counter++; } // UI init setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormSpecs.RELATED_GAP_ROWSPEC, })); JPanel panelTrailerScrapers = new JPanel(); panelTrailerScrapers.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), BUNDLE.getString("scraper.trailer"), TitledBorder.LEADING, TitledBorder.TOP, null, null)); // $NON-NLS-1$ add(panelTrailerScrapers, "2, 2, fill, fill"); panelTrailerScrapers.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.UNRELATED_GAP_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("200dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("100dlu:grow"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_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.UNRELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, })); final JScrollPane scrollPaneScraperDetails = new JScrollPane(); scrollPaneScraperDetails.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPaneScraperDetails.setBorder(null); panelTrailerScrapers.add(scrollPaneScraperDetails, "8, 1, 1, 2, fill, fill"); JPanel panelScraperDetails = new JPanel(); scrollPaneScraperDetails.setViewportView(panelScraperDetails); panelScraperDetails.setLayout(new FormLayout(new ColumnSpec[] { ColumnSpec.decode("default:grow"), }, new RowSpec[] { RowSpec.decode("default:grow"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, })); { // add a CSS rule to force body tags to use the default label font // instead of the value in javax.swing.text.html.default.csss Font font = UIManager.getFont("Label.font"); String bodyRule = "body { font-family: " + font.getFamily() + "; " + "font-size: " + font.getSize() + "pt; }"; tpScraperDescription = new JTextPane(); tpScraperDescription.setOpaque(false); tpScraperDescription.setEditorKit(new HTMLEditorKit()); ((HTMLDocument) tpScraperDescription.getDocument()).getStyleSheet().addRule(bodyRule); panelScraperDetails.add(tpScraperDescription, "1, 1, fill, top"); } panelScraperOptions = new ScrollablePanel(); panelScraperOptions.setLayout(new FlowLayout(FlowLayout.LEFT)); panelScraperDetails.add(panelScraperOptions, "1, 3, fill, top"); JScrollPane scrollPaneScraper = new JScrollPane(); panelTrailerScrapers.add(scrollPaneScraper, "2, 2, 5, 1, fill, fill"); tableTrailerScraper = new JTable(); tableTrailerScraper.setRowHeight(29); scrollPaneScraper.setViewportView(tableTrailerScraper); JSeparator separator = new JSeparator(); panelTrailerScrapers.add(separator, "2, 4, 7, 1"); checkBox = new JCheckBox(BUNDLE.getString("Settings.trailer.preferred")); //$NON-NLS-1$ panelTrailerScrapers.add(checkBox, "2, 6, 7, 1"); JLabel lblTrailerSource = new JLabel(BUNDLE.getString("Settings.trailer.source")); //$NON-NLS-1$ panelTrailerScrapers.add(lblTrailerSource, "4, 8, right, default"); cbTrailerSource = new JComboBox<>(); cbTrailerSource.setModel(new DefaultComboBoxModel<>(MovieTrailerSources.values())); panelTrailerScrapers.add(cbTrailerSource, "6, 8, fill, default"); JLabel lblTrailerQuality = new JLabel(BUNDLE.getString("Settings.trailer.quality")); //$NON-NLS-1$ panelTrailerScrapers.add(lblTrailerQuality, "4, 10, right, default"); cbTrailerQuality = new JComboBox<>(); cbTrailerQuality.setModel(new DefaultComboBoxModel<>(MovieTrailerQuality.values())); panelTrailerScrapers.add(cbTrailerQuality, "6, 10, fill, default"); chckbxAutomaticTrailerDownload = new JCheckBox(BUNDLE.getString("Settings.trailer.automaticdownload")); //$NON-NLS-1$ panelTrailerScrapers.add(chckbxAutomaticTrailerDownload, "2, 12, 7, 1"); JLabel lblAutomaticTrailerDownloadHint = new JLabel( BUNDLE.getString("Settings.trailer.automaticdownload.hint")); //$NON-NLS-1$ TmmFontHelper.changeFont(lblAutomaticTrailerDownloadHint, 0.833); panelTrailerScrapers.add(lblAutomaticTrailerDownloadHint, "4, 14, 5, 1"); initDataBindings(); // adjust table columns // Checkbox and Logo shall have minimal width TableColumnResizer.setMaxWidthForColumn(tableTrailerScraper, 0, 2); TableColumnResizer.setMaxWidthForColumn(tableTrailerScraper, 1, 2); TableColumnResizer.adjustColumnPreferredWidths(tableTrailerScraper, 5); tableTrailerScraper.getModel().addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent arg0) { // click on the checkbox if (arg0.getColumn() == 0) { int row = arg0.getFirstRow(); TrailerScraper changedScraper = scrapers.get(row); if (changedScraper.active) { settings.addMovieTrailerScraper(changedScraper.getScraperId()); } else { settings.removeMovieTrailerScraper(changedScraper.getScraperId()); } } } }); // implement selection listener to load settings tableTrailerScraper.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { int index = tableTrailerScraper.convertRowIndexToModel(tableTrailerScraper.getSelectedRow()); if (index > -1) { panelScraperOptions.removeAll(); if (scrapers.get(index).getMediaProvider().getProviderInfo().getConfig().hasConfig()) { panelScraperOptions .add(new MediaScraperConfigurationPanel(scrapers.get(index).getMediaProvider())); } panelScraperOptions.revalidate(); } } }); // select default movie scraper if (selectedIndex < 0) { selectedIndex = 0; } if (counter > 0) { tableTrailerScraper.getSelectionModel().setSelectionInterval(selectedIndex, selectedIndex); } }