/** * Set the value of taskbar * * @param newVar the new value of taskbar */ private void setTaskbar() { /** *****************Task Bar**************** */ taskbar = new JTextArea(); taskbar.setVisible(true); taskbar.setBackground(Color.lightGray); taskbar.setEditable(false); /** *****************End of Task Bar**************** */ }
public void setOutputPanel() { BoxLayout box = new BoxLayout(output, BoxLayout.Y_AXIS); output.setLayout(box); Color c1 = new Color(166, 209, 241); Color c2 = new Color(204, 210, 211); JLabel label3 = new JLabel("Messaggi interni:"); output.add(label3); outp.setBackground(c1); outp.setAutoscrolls(true); outp.setEditable(false); intmsg.setBackground(c2); intmsg.setAutoscrolls(true); intmsg.setEditable(false); output.add(scrollPaneM); JLabel label4 = new JLabel("Output:"); output.add(label4); output.add(scrollPaneO); output.setBorder(BorderFactory.createEtchedBorder()); }
/** * @param shortcut dialog will be initialized with this <code>shortcut</code>. It can be <code> * null</code> if dialog is used to create new mouse shortcut. */ public MouseShortcutDialog( JComponent parentComponent, MouseShortcut shortcut, @NotNull Keymap keymap, @NotNull String actiondId, @NotNull Group mainGroup) { super(parentComponent, true); setTitle(KeyMapBundle.message("mouse.shortcut.dialog.title")); myKeymap = keymap; myActionId = actiondId; myMainGroup = mainGroup; myRbSingleClick = new JRadioButton(KeyMapBundle.message("mouse.shortcut.dialog.single.click.radio")); myRbDoubleClick = new JRadioButton(KeyMapBundle.message("mouse.shortcut.dialog.double.click.radio")); ButtonGroup buttonGroup = new ButtonGroup(); buttonGroup.add(myRbSingleClick); buttonGroup.add(myRbDoubleClick); myLblPreview = new JLabel(" "); myClickPad = new MyClickPad(); myTarConflicts = new JTextArea(); myTarConflicts.setFocusable(false); myTarConflicts.setEditable(false); myTarConflicts.setBackground(UIUtil.getPanelBackground()); myTarConflicts.setLineWrap(true); myTarConflicts.setWrapStyleWord(true); if (shortcut != null) { if (shortcut.getClickCount() == 1) { myRbSingleClick.setSelected(true); } else { myRbDoubleClick.setSelected(true); } myButton = shortcut.getButton(); myModifiers = shortcut.getModifiers(); } else { myRbSingleClick.setSelected(true); myButton = -1; myModifiers = -1; } updatePreviewAndConflicts(); init(); }
private void jbInit() throws Exception { titledBorder1 = new TitledBorder(""); this.setLayout(baseLayout); double[][] lower_size = { {TableLayout.PREFERRED, TableLayout.FILL, 25}, {25, 25, TableLayout.FILL} }; mLowerPanelLayout = new TableLayout(lower_size); mLowerPanel.setLayout(mLowerPanelLayout); double[][] dir_size = { {TableLayout.FILL, TableLayout.PREFERRED}, {TableLayout.PREFERRED, TableLayout.FILL} }; mDirectionsPanelLayout = new TableLayout(dir_size); mDirectionsPanel.setLayout(mDirectionsPanelLayout); // Try to get icons for the toolbar buttons try { ClassLoader loader = getClass().getClassLoader(); mAddIcon = new ImageIcon(loader.getResource(COMMON_IMG_ROOT + "/add.gif")); mRemoveIcon = new ImageIcon(loader.getResource(COMMON_IMG_ROOT + "/remove.gif")); mDisabledRemoveIcon = new ImageIcon(loader.getResource(COMMON_IMG_ROOT + "/remove_disabled.gif")); mAddNodeBtn.setIcon(mAddIcon); mRemoveNodeBtn.setIcon(mRemoveIcon); mRemoveNodeBtn.setDisabledIcon(mDisabledRemoveIcon); } catch (Exception e) { // Ack! No icons. Use text labels instead mAddNodeBtn.setText("Add"); mRemoveNodeBtn.setText("Remove"); } /* mAddNodeBtn.setMaximumSize(new Dimension(130, 33)); mAddNodeBtn.setMinimumSize(new Dimension(130, 33)); mAddNodeBtn.setPreferredSize(new Dimension(130, 33)); mAddNodeBtn.setText("Add Node"); */ mAddNodeBtn.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { mAddNodeBtn_actionPerformed(e); } }); /* mRemoveNodeBtn.setMaximumSize(new Dimension(130, 33)); mRemoveNodeBtn.setMinimumSize(new Dimension(130, 33)); mRemoveNodeBtn.setPreferredSize(new Dimension(130, 33)); mRemoveNodeBtn.setText("Remove Node"); */ mRemoveNodeBtn.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { mRemoveNode(); } }); mHostnameLabel.setHorizontalAlignment(SwingConstants.TRAILING); mHostnameLabel.setLabelFor(mHostnameField); mHostnameLabel.setText("Hostname:"); mHostnameField.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { mAddNodeBtn_actionPerformed(e); } }); mDirectionsPanel.setBorder(BorderFactory.createEtchedBorder()); mTitleLabel.setFont(new java.awt.Font("Serif", 1, 20)); mTitleLabel.setHorizontalAlignment(SwingConstants.CENTER); mTitleLabel.setText("Add Cluster Nodes"); mDirectionsLabel.setText("Click on the add button to add nodes to your cluster configuration."); mDirectionsLabel.setLineWrap(true); mDirectionsLabel.setEditable(false); mDirectionsLabel.setBackground(mTitleLabel.getBackground()); baseLayout.setHgap(5); baseLayout.setVgap(5); mLowerPanel.add( mHostnameLabel, new TableLayoutConstraints(0, 0, 0, 0, TableLayout.FULL, TableLayout.FULL)); mLowerPanel.add( mHostnameField, new TableLayoutConstraints(1, 0, 1, 0, TableLayout.FULL, TableLayout.FULL)); mLowerPanel.add( mListScrollPane1, new TableLayoutConstraints(0, 1, 1, 2, TableLayout.FULL, TableLayout.FULL)); mLowerPanel.add( mAddNodeBtn, new TableLayoutConstraints(2, 0, 2, 0, TableLayout.FULL, TableLayout.FULL)); mLowerPanel.add( mRemoveNodeBtn, new TableLayoutConstraints(2, 1, 2, 1, TableLayout.FULL, TableLayout.FULL)); this.add(mLowerPanel, BorderLayout.CENTER); mListScrollPane1.getViewport().add(lstNodes, null); mDirectionsPanel.add( mTitleLabel, new TableLayoutConstraints(0, 0, 0, 0, TableLayout.FULL, TableLayout.FULL)); mDirectionsPanel.add( mDirectionsLabel, new TableLayoutConstraints(0, 1, 0, 1, TableLayout.FULL, TableLayout.FULL)); mDirectionsPanel.add( mIconLabel, new TableLayoutConstraints(1, 0, 1, 1, TableLayout.FULL, TableLayout.FULL)); this.add(mDirectionsPanel, BorderLayout.NORTH); }
public JComponent buildCommon() { String colSpec = FormLayoutUtil.getColSpec(COMMON_COL_SPEC, orientation); FormLayout layout = new FormLayout(colSpec, COMMON_ROW_SPEC); PanelBuilder builder = new PanelBuilder(layout); builder.setBorder(Borders.EMPTY_BORDER); builder.setOpaque(false); CellConstraints cc = new CellConstraints(); maxbuffer = new JTextField("" + configuration.getMaxMemoryBufferSize()); maxbuffer.addKeyListener( new KeyListener() { @Override public void keyPressed(KeyEvent e) {} @Override public void keyTyped(KeyEvent e) {} @Override public void keyReleased(KeyEvent e) { try { int ab = Integer.parseInt(maxbuffer.getText()); configuration.setMaxMemoryBufferSize(ab); } catch (NumberFormatException nfe) { LOGGER.debug( "Could not parse max memory buffer size from \"" + maxbuffer.getText() + "\""); } } }); JComponent cmp = builder.addSeparator( Messages.getString("NetworkTab.5"), FormLayoutUtil.flip(cc.xyw(1, 1, 3), colSpec, orientation)); cmp = (JComponent) cmp.getComponent(0); cmp.setFont(cmp.getFont().deriveFont(Font.BOLD)); builder.addLabel( Messages.getString("NetworkTab.6") .replaceAll("MAX_BUFFER_SIZE", configuration.getMaxMemoryBufferSizeStr()), FormLayoutUtil.flip(cc.xy(1, 3), colSpec, orientation)); builder.add(maxbuffer, FormLayoutUtil.flip(cc.xy(3, 3), colSpec, orientation)); String nCpusLabel = String.format( Messages.getString("NetworkTab.7"), Runtime.getRuntime().availableProcessors()); builder.addLabel(nCpusLabel, FormLayoutUtil.flip(cc.xy(1, 5), colSpec, orientation)); String[] guiCores = new String[MAX_CORES]; for (int i = 0; i < MAX_CORES; i++) { guiCores[i] = Integer.toString(i + 1); } nbcores = new JComboBox(guiCores); nbcores.setEditable(false); int nbConfCores = configuration.getNumberOfCpuCores(); if (nbConfCores > 0 && nbConfCores <= MAX_CORES) { nbcores.setSelectedItem(Integer.toString(nbConfCores)); } else { nbcores.setSelectedIndex(0); } nbcores.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent e) { configuration.setNumberOfCpuCores(Integer.parseInt(e.getItem().toString())); } }); builder.add(nbcores, FormLayoutUtil.flip(cc.xy(3, 5), colSpec, orientation)); chapter_interval = new JTextField("" + configuration.getChapterInterval()); chapter_interval.setEnabled(configuration.isChapterSupport()); chapter_interval.addKeyListener( new KeyListener() { @Override public void keyPressed(KeyEvent e) {} @Override public void keyTyped(KeyEvent e) {} @Override public void keyReleased(KeyEvent e) { try { int ab = Integer.parseInt(chapter_interval.getText()); configuration.setChapterInterval(ab); } catch (NumberFormatException nfe) { LOGGER.debug( "Could not parse chapter interval from \"" + chapter_interval.getText() + "\""); } } }); chapter_support = new JCheckBox(Messages.getString("TrTab2.52")); chapter_support.setContentAreaFilled(false); chapter_support.setSelected(configuration.isChapterSupport()); chapter_support.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent e) { configuration.setChapterSupport((e.getStateChange() == ItemEvent.SELECTED)); chapter_interval.setEnabled(configuration.isChapterSupport()); } }); builder.add(chapter_support, FormLayoutUtil.flip(cc.xy(1, 7), colSpec, orientation)); builder.add(chapter_interval, FormLayoutUtil.flip(cc.xy(3, 7), colSpec, orientation)); cmp = builder.addSeparator( Messages.getString("TrTab2.3"), FormLayoutUtil.flip(cc.xyw(1, 11, 3), colSpec, orientation)); cmp = (JComponent) cmp.getComponent(0); cmp.setFont(cmp.getFont().deriveFont(Font.BOLD)); channels = new JComboBox( new Object[] { Messages.getString("TrTab2.55"), Messages.getString("TrTab2.56") /*, "8 channels 7.1" */ }); // 7.1 not supported by Mplayer :\ channels.setEditable(false); if (configuration.getAudioChannelCount() == 2) { channels.setSelectedIndex(0); } else { channels.setSelectedIndex(1); } channels.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent e) { configuration.setAudioChannelCount( Integer.parseInt(e.getItem().toString().substring(0, 1))); } }); builder.addLabel( Messages.getString("TrTab2.50"), FormLayoutUtil.flip(cc.xy(1, 13), colSpec, orientation)); builder.add(channels, FormLayoutUtil.flip(cc.xy(3, 13), colSpec, orientation)); forcePCM = new JCheckBox(Messages.getString("TrTab2.27")); forcePCM.setContentAreaFilled(false); if (configuration.isMencoderUsePcm()) { forcePCM.setSelected(true); } forcePCM.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent e) { configuration.setMencoderUsePcm(e.getStateChange() == ItemEvent.SELECTED); } }); builder.add(forcePCM, FormLayoutUtil.flip(cc.xyw(1, 15, 3), colSpec, orientation)); ac3remux = new JCheckBox( Messages.getString("MEncoderVideo.32") + (Platform.isWindows() ? Messages.getString("TrTab2.21") : "")); ac3remux.setContentAreaFilled(false); if (configuration.isRemuxAC3()) { ac3remux.setSelected(true); } ac3remux.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent e) { configuration.setRemuxAC3((e.getStateChange() == ItemEvent.SELECTED)); } }); builder.add(ac3remux, FormLayoutUtil.flip(cc.xyw(1, 17, 3), colSpec, orientation)); forceDTSinPCM = new JCheckBox( Messages.getString("TrTab2.28") + (Platform.isWindows() ? Messages.getString("TrTab2.21") : "")); forceDTSinPCM.setContentAreaFilled(false); if (configuration.isDTSEmbedInPCM()) { forceDTSinPCM.setSelected(true); } forceDTSinPCM.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { configuration.setDTSEmbedInPCM(forceDTSinPCM.isSelected()); if (configuration.isDTSEmbedInPCM()) { JOptionPane.showMessageDialog( (JFrame) (SwingUtilities.getWindowAncestor((Component) PMS.get().getFrame())), Messages.getString("TrTab2.10"), "Information", JOptionPane.INFORMATION_MESSAGE); } } }); builder.add(forceDTSinPCM, FormLayoutUtil.flip(cc.xyw(1, 19, 3), colSpec, orientation)); abitrate = new JTextField("" + configuration.getAudioBitrate()); abitrate.addKeyListener( new KeyListener() { @Override public void keyPressed(KeyEvent e) {} @Override public void keyTyped(KeyEvent e) {} @Override public void keyReleased(KeyEvent e) { try { int ab = Integer.parseInt(abitrate.getText()); configuration.setAudioBitrate(ab); } catch (NumberFormatException nfe) { LOGGER.debug("Could not parse audio bitrate from \"" + abitrate.getText() + "\""); } } }); builder.addLabel( Messages.getString("TrTab2.29"), FormLayoutUtil.flip(cc.xy(1, 21), colSpec, orientation)); builder.add(abitrate, FormLayoutUtil.flip(cc.xy(3, 21), colSpec, orientation)); mpeg2remux = new JCheckBox( Messages.getString("MEncoderVideo.39") + (Platform.isWindows() ? Messages.getString("TrTab2.21") : "")); mpeg2remux.setContentAreaFilled(false); if (configuration.isMencoderRemuxMPEG2()) { mpeg2remux.setSelected(true); } mpeg2remux.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent e) { configuration.setMencoderRemuxMPEG2((e.getStateChange() == ItemEvent.SELECTED)); } }); builder.add(mpeg2remux, FormLayoutUtil.flip(cc.xyw(1, 23, 3), colSpec, orientation)); cmp = builder.addSeparator( Messages.getString("TrTab2.4"), FormLayoutUtil.flip(cc.xyw(1, 25, 3), colSpec, orientation)); cmp = (JComponent) cmp.getComponent(0); cmp.setFont(cmp.getFont().deriveFont(Font.BOLD)); builder.addLabel( Messages.getString("TrTab2.32"), FormLayoutUtil.flip(cc.xyw(1, 29, 3), colSpec, orientation)); Object data[] = new Object[] { configuration.getMencoderMainSettings(), /* default */ String.format( "keyint=5:vqscale=1:vqmin=2 /* %s */", Messages.getString("TrTab2.60")), /* great */ String.format( "keyint=5:vqscale=1:vqmin=1 /* %s */", Messages.getString("TrTab2.61")), /* lossless */ String.format( "keyint=5:vqscale=2:vqmin=3 /* %s */", Messages.getString("TrTab2.62")), /* good (wired) */ String.format( "keyint=25:vqmax=5:vqmin=2 /* %s */", Messages.getString("TrTab2.63")), /* good (wireless) */ String.format( "keyint=25:vqmax=7:vqmin=2 /* %s */", Messages.getString("TrTab2.64")), /* medium (wireless) */ String.format( "keyint=25:vqmax=8:vqmin=3 /* %s */", Messages.getString("TrTab2.65")) /* low */ }; MyComboBoxModel cbm = new MyComboBoxModel(data); vq = new JComboBox(cbm); vq.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { String s = (String) e.getItem(); if (s.indexOf("/*") > -1) { s = s.substring(0, s.indexOf("/*")).trim(); } configuration.setMencoderMainSettings(s); } } }); vq.getEditor() .getEditorComponent() .addKeyListener( new KeyListener() { @Override public void keyPressed(KeyEvent e) {} @Override public void keyTyped(KeyEvent e) {} @Override public void keyReleased(KeyEvent e) { vq.getItemListeners()[0].itemStateChanged( new ItemEvent(vq, 0, vq.getEditor().getItem(), ItemEvent.SELECTED)); } }); vq.setEditable(true); builder.add(vq, FormLayoutUtil.flip(cc.xyw(1, 31, 3), colSpec, orientation)); String help1 = Messages.getString("TrTab2.39"); help1 += Messages.getString("TrTab2.40"); help1 += Messages.getString("TrTab2.41"); help1 += Messages.getString("TrTab2.42"); help1 += Messages.getString("TrTab2.43"); help1 += Messages.getString("TrTab2.44"); JTextArea decodeTips = new JTextArea(help1); decodeTips.setEditable(false); decodeTips.setBorder(BorderFactory.createEtchedBorder()); decodeTips.setBackground(new Color(255, 255, 192)); builder.add(decodeTips, FormLayoutUtil.flip(cc.xyw(1, 41, 3), colSpec, orientation)); disableSubs = new JCheckBox(Messages.getString("TrTab2.51")); disableSubs.setContentAreaFilled(false); cmp = builder.addSeparator( Messages.getString("TrTab2.7"), FormLayoutUtil.flip(cc.xyw(1, 33, 3), colSpec, orientation)); cmp = (JComponent) cmp.getComponent(0); cmp.setFont(cmp.getFont().deriveFont(Font.BOLD)); builder.add(disableSubs, FormLayoutUtil.flip(cc.xy(1, 35), colSpec, orientation)); builder.addLabel( Messages.getString("TrTab2.8"), FormLayoutUtil.flip(cc.xy(1, 37), colSpec, orientation)); notranscode = new JTextField(configuration.getNoTranscode()); notranscode.addKeyListener( new KeyListener() { @Override public void keyPressed(KeyEvent e) {} @Override public void keyTyped(KeyEvent e) {} @Override public void keyReleased(KeyEvent e) { configuration.setNoTranscode(notranscode.getText()); } }); builder.add(notranscode, FormLayoutUtil.flip(cc.xy(3, 37), colSpec, orientation)); builder.addLabel( Messages.getString("TrTab2.9"), FormLayoutUtil.flip(cc.xy(1, 39), colSpec, orientation)); forcetranscode = new JTextField(configuration.getForceTranscode()); forcetranscode.addKeyListener( new KeyListener() { @Override public void keyPressed(KeyEvent e) {} @Override public void keyTyped(KeyEvent e) {} @Override public void keyReleased(KeyEvent e) { configuration.setForceTranscode(forcetranscode.getText()); } }); builder.add(forcetranscode, FormLayoutUtil.flip(cc.xy(3, 39), colSpec, orientation)); JPanel panel = builder.getPanel(); // Apply the orientation to the panel and all components in it panel.applyComponentOrientation(orientation); return panel; }
/** * The constructor creates the NodeTable and DirectedGraph taken the information from files * lines-gbg.txt and stops-gbg.txt and makes itself visible. */ public ShortRoute(String file) { // try to convert to UTF-8 across plattforms to make Swedish chars work // System.out.println("charset = " + java.nio.charset.Charset.defaultCharset()); // MacRoman macintosh Windows-1252 ISO 8859-1 UTF-8 try { // convert whatever this file is encoded in to UTF-8, // kill the exception (can't happen) introText = new String( introText.getBytes(java.nio.charset.Charset.defaultCharset().toString()), "UTF-8"); felTextStart = new String( felTextStart.getBytes(java.nio.charset.Charset.defaultCharset().toString()), "UTF-8"); felTextSlut = new String( felTextSlut.getBytes(java.nio.charset.Charset.defaultCharset().toString()), "UTF-8"); frome = new String(frome.getBytes(java.nio.charset.Charset.defaultCharset().toString()), "UTF-8"); } catch (UnsupportedEncodingException e) { System.exit(0); } // read the graph and draw it in a separate window // creates the graph and fills the p-queue "names" karta.setLocation(50, 250); if (file == null) { readAndDrawGraph(); } else { readAndDrawBIGGraph(file); } System.out.println("Version with sorting fixed"); // debug // now to the graphics in the Frame // Left part // select is a panel for structuring the left part // i.e label, textfield for "from", label, textfield for "to" JPanel select = new JPanel(new GridLayout(4, 1)); select.setBackground(Color.yellow); select.add(new JLabel("Ange startpunkt !", JLabel.CENTER)); select.add(from); select.add(new JLabel("Ange slutpunkt !", JLabel.CENTER)); select.add(to); from.setBackground(Color.white); from.setForeground(Color.blue); to.setBackground(Color.white); to.setForeground(Color.blue); from.addActionListener(this); to.addActionListener(this); // Middle part // route is the middle text area part where messages are displayed // give the middle text area a scrollbar to the right route = new JTextArea(introText, 12, 40); route.setEditable(false); JScrollPane routeScrollPane = new JScrollPane(route); routeScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); route.setBackground(Color.white); route.setForeground(Color.blue); // Rigth part JLabel head = new JLabel(" **** Alternativ ***** "); head.setForeground(Color.red); // add all stations to the right scrollpane // tanken är att dom skall vara valbara men det fungerar inte än // En JList vill ha en ListModel som parameter // En ListModel är ett interface som implementeras av klassen AbstractListModel // DefaultListModel ärver AbstractListModel DefaultListModel<String> valList = new DefaultListModel<String>(); JList<String> alternativ = new JList<String>(valList); alternativ.setBackground(Color.white); alternativ.setForeground(Color.blue); // add a scroll pane to the station list in alternativ stationList = new JScrollPane(alternativ); // read names from p-queue and load them into the list while (!names.isEmpty()) valList.addElement(names.poll()); // panel for structure JPanel valPanel = new JPanel(new BorderLayout()); valPanel.setBackground(Color.white); valPanel.add(head, "North"); valPanel.add(stationList, "Center"); // put it all together in the frame add(select, "West"); add(routeScrollPane, "Center"); add(valPanel, "East"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pack(); setVisible(true); } // end ShortRoute
public WizStepManyTextFields(Wizard w, String instr, Vector strings) { // store wizard? _instructions.setText(instr); _instructions.setWrapStyleWord(true); _instructions.setEditable(false); _instructions.setBorder(null); _instructions.setBackground(_mainPanel.getBackground()); _mainPanel.setBorder(new EtchedBorder()); GridBagLayout gb = new GridBagLayout(); _mainPanel.setLayout(gb); GridBagConstraints c = new GridBagConstraints(); c.ipadx = 3; c.ipady = 3; c.weightx = 0.0; c.weighty = 0.0; c.anchor = GridBagConstraints.EAST; JLabel image = new JLabel(""); // image.setMargin(new Insets(0, 0, 0, 0)); image.setIcon(WIZ_ICON); image.setBorder(null); c.gridx = 0; c.gridheight = GridBagConstraints.REMAINDER; c.gridy = 0; c.anchor = GridBagConstraints.NORTH; gb.setConstraints(image, c); _mainPanel.add(image); c.weightx = 0.0; c.gridx = 2; c.gridheight = 1; c.gridwidth = 3; c.gridy = 0; c.fill = GridBagConstraints.NONE; gb.setConstraints(_instructions, c); _mainPanel.add(_instructions); c.gridx = 1; c.gridy = 1; c.weightx = 0.0; c.gridwidth = 1; c.fill = GridBagConstraints.NONE; SpacerPanel spacer = new SpacerPanel(); gb.setConstraints(spacer, c); _mainPanel.add(spacer); c.gridx = 2; c.weightx = 1.0; c.anchor = GridBagConstraints.WEST; c.gridwidth = 1; int size = strings.size(); for (int i = 0; i < size; i++) { c.gridy = 2 + i; String s = (String) strings.elementAt(i); JTextField tf = new JTextField(s, 50); tf.setMinimumSize(new Dimension(200, 20)); tf.getDocument().addDocumentListener(this); _fields.addElement(tf); gb.setConstraints(tf, c); _mainPanel.add(tf); } c.gridx = 1; c.gridy = 3 + strings.size(); c.weightx = 0.0; c.gridwidth = 1; c.fill = GridBagConstraints.NONE; SpacerPanel spacer2 = new SpacerPanel(); gb.setConstraints(spacer2, c); _mainPanel.add(spacer2); }
private JPanel getContentPanel(WizardData wzd) { JPanel contentPanel1 = new JPanel(); welcomeTitle = new JLabel(); contentPanel1.setLayout(new java.awt.BorderLayout()); welcomeTitle.setFont(new java.awt.Font("MS Sans Serif", Font.BOLD, 11)); welcomeTitle.setText("Please insert already existing language files!"); contentPanel1.add(welcomeTitle, BorderLayout.NORTH); // ------------------------------------------------------------------------ Container mainPanel = new JPanel(); SpringLayout layout = new SpringLayout(); mainPanel.setLayout(layout); JTextArea infoText = new JTextArea(); infoText.setLineWrap(false); infoText.setEditable(false); infoText.setFocusable(false); infoText.setBackground(mainPanel.getBackground()); infoText.append(TInfoText.runtime.getText("newwizard", "site2")); JDialog parent = null; if (wzd.getWizard() != null) { parent = wzd.getWizard().getDialog(); } table = new LanguageManagerPanel(TGlobal.projects.getCurrentProject(), parent, true); rescanButton.addActionListener(this); baseButton.addActionListener(this); // Create and add the components. mainPanel.add(infoText); mainPanel.add(baseLabel); mainPanel.add(baseField); mainPanel.add(baseButton); mainPanel.add(rescanButton); mainPanel.add(table); // infoText layout.putConstraint(SpringLayout.WEST, infoText, 5, SpringLayout.WEST, mainPanel); layout.putConstraint(SpringLayout.NORTH, infoText, 5, SpringLayout.NORTH, mainPanel); // baseLabel ------------------------------------------------------------- layout.putConstraint(SpringLayout.WEST, baseLabel, 0, SpringLayout.WEST, infoText); layout.putConstraint(SpringLayout.NORTH, baseLabel, 12, SpringLayout.SOUTH, infoText); // nameField layout.putConstraint(SpringLayout.WEST, baseField, 5, SpringLayout.EAST, baseLabel); layout.putConstraint(SpringLayout.NORTH, baseField, 10, SpringLayout.SOUTH, infoText); // baseButton layout.putConstraint(SpringLayout.WEST, baseButton, 5, SpringLayout.EAST, baseField); layout.putConstraint(SpringLayout.NORTH, baseButton, 7, SpringLayout.SOUTH, infoText); // rescanButton layout.putConstraint(SpringLayout.WEST, rescanButton, 5, SpringLayout.EAST, baseButton); layout.putConstraint(SpringLayout.NORTH, rescanButton, 7, SpringLayout.SOUTH, infoText); // table layout.putConstraint(SpringLayout.WEST, table, 5, SpringLayout.WEST, mainPanel); layout.putConstraint(SpringLayout.NORTH, table, 15, SpringLayout.SOUTH, baseField); // panel edges ------------------------------------------------------ layout.putConstraint(SpringLayout.EAST, mainPanel, 5, SpringLayout.EAST, infoText); layout.putConstraint(SpringLayout.SOUTH, mainPanel, 5, SpringLayout.SOUTH, table); layout.layoutContainer(mainPanel); contentPanel1.add(mainPanel, BorderLayout.CENTER); return contentPanel1; }
private void initializeComponents() { this.setTitle("Synchro - Kopierassistent"); this.setBounds(0, 0, 550, 600); this.setResizable(true); this.setLayout(null); this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); this.addWindowListener(this); mainPanel = new JPanel(); mainPanel.setBounds(0, 0, this.getWidth() - 20, 25); // fcPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); mainPanel.setLayout(null); btnBackup = new JButton("Backup"); btnBackup.setBounds(this.getWidth() / 2, 0, this.getWidth() / 2 - 20, mainPanel.getHeight()); btnBackup.addActionListener(this); mainPanel.add(btnBackup); this.add(mainPanel); fcPanel = new JPanel(); fcPanel.setBounds(10, 40, this.getWidth(), 260); // fcPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); fcPanel.setLayout(null); quellLabel = new JLabel("Bitte Quellverzeichnis auswählen"); quellLabel.setBounds(10, 5, 320, 20); fcPanel.add(quellLabel); quellListModel = new DefaultListModel<>(); quellJList = new JList<ListItem>(quellListModel); quellJList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); quellJList.setLayoutOrientation(JList.VERTICAL); quellJList.addListSelectionListener(this); listBoxScroller = new JScrollPane(quellJList); listBoxScroller.setBounds(0, 30, 315, 100); fcPanel.add(listBoxScroller); btnQAuswahl = new JButton("Quellverz. hinzufügen"); btnQAuswahl.setBounds(320, 30, 200, 25); btnQAuswahl.addActionListener(this); fcPanel.add(btnQAuswahl); btnQEntfernen = new JButton("Quellverz. entfernen"); btnQEntfernen.setBounds(320, 60, 200, 25); btnQEntfernen.addActionListener(this); fcPanel.add(btnQEntfernen); zielLabel = new JLabel("Bitte Zielverzeichnis auswählen"); zielLabel.setBounds(10, 135, 320, 20); fcPanel.add(zielLabel); zielListModel = new DefaultListModel<>(); zielJList = new JList<ListItem>(zielListModel); zielJList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); zielJList.setLayoutOrientation(JList.VERTICAL); zielJList.addListSelectionListener(this); listBoxScroller2 = new JScrollPane(zielJList); listBoxScroller2.setBounds(0, 160, 315, 100); fcPanel.add(listBoxScroller2); btnZAuswahl = new JButton("Zielverz. hinzufügen"); btnZAuswahl.setBounds(320, 160, 200, 25); btnZAuswahl.addActionListener(this); fcPanel.add(btnZAuswahl); btnZEntfernen = new JButton("Zielverz. entfernen"); btnZEntfernen.setBounds(320, 190, 200, 25); btnZEntfernen.addActionListener(this); fcPanel.add(btnZEntfernen); this.add(fcPanel); ButtonGroup bGrp = new ButtonGroup(); optionPanel = new JPanel(); optionPanel.setBounds(10, 300 + 10, this.getWidth() - 40, 90); optionPanel.setPreferredSize(new Dimension(this.getWidth() - 40, 90)); // optionPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); optionPanel.setLayout(new GridLayout(3, 1)); nUebSchr = new JRadioButton("Keine Dateien überschreiben"); nUebSchr.addItemListener(this); bGrp.add(nUebSchr); optionPanel.add(nUebSchr); ueSchr = new JRadioButton("Neuere Dateien überschreiben"); ueSchr.addItemListener(this); bGrp.add(ueSchr); optionPanel.add(ueSchr); aUeSchr = new JRadioButton("Alle Dateien überschreiben"); aUeSchr.addItemListener(this); bGrp.add(aUeSchr); optionPanel.add(aUeSchr); this.add(optionPanel); syncPanel = new JPanel(); syncPanel.setBounds( 10, optionPanel.getY() + optionPanel.getHeight() + 10, this.getWidth() - 30, 25); // syncPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); syncPanel.setLayout(new BorderLayout()); btnSync = new JButton("Sync it!"); btnSync.setBounds(0, 0, 150, (syncPanel.getHeight() / 3)); btnSync.addActionListener(this); btnSync.setPreferredSize(new Dimension(150, (syncPanel.getHeight() / 3))); btnSync.setMaximumSize(new Dimension(150, (syncPanel.getHeight() / 3))); syncPanel.add(btnSync, BorderLayout.LINE_START); btnAbbruch = new JButton("Abbrechen"); btnAbbruch.setBounds(0, 0, 150, (syncPanel.getHeight() / 3)); btnAbbruch.addActionListener(this); btnAbbruch.setPreferredSize(new Dimension(150, (syncPanel.getHeight() / 3))); btnAbbruch.setMaximumSize(new Dimension(150, (syncPanel.getHeight() / 3))); btnAbbruch.setVisible(false); syncPanel.add(btnAbbruch, BorderLayout.LINE_END); progressBar = new JProgressBar(JProgressBar.HORIZONTAL); progressBar.setBorderPainted(true); progressBar.setPreferredSize(new Dimension(300, (syncPanel.getHeight() / 3))); progressBar.setForeground(Color.RED); progressBar.setStringPainted(true); progressBar.setVisible(true); syncPanel.add(progressBar, BorderLayout.CENTER); this.add(syncPanel); logPanel = new JPanel(); logPanel.setBounds( 10, syncPanel.getY() + syncPanel.getHeight() + 10, this.getWidth() - 30, 105); logPanel.setLayout(new BorderLayout()); textArea = new JTextArea(); textArea.setMargin(new Insets(3, 3, 3, 3)); textArea.setBackground(Color.black); textArea.setForeground(Color.LIGHT_GRAY); textArea.setAutoscrolls(true); textArea.setFocusable(false); textAreaScroller = new JScrollPane(textArea); DefaultCaret caret = (DefaultCaret) textArea.getCaret(); caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE); textAreaScroller.setBounds(0, 0, syncPanel.getWidth(), 50); logPanel.add(textAreaScroller, BorderLayout.CENTER); this.add(logPanel, BorderLayout.SOUTH); }
public void setInputPanel() throws IOException { final String newline = "\n"; final JTextArea log = new JTextArea(2, 28); GridBagLayout gridbag = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); input.setLayout(gridbag); // Create the log first, because the action listeners // need to refer to it. log.setMargin(new Insets(1, 1, 1, 1)); log.setEditable(false); JScrollPane logScrollPane = new JScrollPane(log); // Create a file chooser final JFileChooser fc = new JFileChooser(); // Create the open button ImageIcon openIcon = new ImageIcon("Images/open.gif"); JButton openButton = new JButton("Open a File...", openIcon); openButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int returnVal = fc.showOpenDialog(prologApplet.this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); String name = file.getName(); String path = file.getAbsolutePath(); try { FileInputStream inps = new FileInputStream(path); ch = 0; ss = ""; while (ch != -1) { ch = inps.read(); ss = ss + (char) ch; } inps.close(); } catch (Exception exc) { System.out.println("" + e); } code.selectAll(); code.cut(); code.append(ss); log.append("Opening: " + name + "." + newline); } else { log.append("Open command cancelled by user." + newline); } } }); // Create the save button ImageIcon saveIcon = new ImageIcon("Images/save.gif"); JButton saveButton = new JButton("Save a File...", saveIcon); saveButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int returnVal = fc.showSaveDialog(prologApplet.this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); // this is where a real application would save the file. log.append("Saving: " + file.getName() + "." + newline); } else { log.append("Save command cancelled by user." + newline); } } }); // For layout purposes, put the buttons in a separate panel JPanel buttonPanel = new JPanel(); buttonPanel.add(openButton); buttonPanel.add(saveButton); // Explicitly set the focus sequence. // rimossi poichè deprecati // openButton.setNextFocusableComponent(saveButton); // saveButton.setNextFocusableComponent(openButton); // Add the buttons and the log to the frame // Container contentPane = getContentPane(); // contentPane.add(buttonPanel, BorderLayout.NORTH); // contentPane.add(logScrollPane, BorderLayout.CENTER); c.gridx = 0; c.gridy = 0; c.gridwidth = 3; c.fill = GridBagConstraints.NONE; gridbag.setConstraints(buttonPanel, c); input.add(buttonPanel); c.gridx = 0; c.gridy = 1; c.gridwidth = 3; c.fill = GridBagConstraints.NONE; gridbag.setConstraints(logScrollPane, c); input.add(logScrollPane); JLabel label1 = new JLabel("Codice:"); c.gridx = 0; c.gridy = 2; c.gridwidth = 3; c.fill = GridBagConstraints.NONE; gridbag.setConstraints(label1, c); input.add(label1); c.gridx = 0; c.gridy = 3; c.gridwidth = 3; c.fill = GridBagConstraints.HORIZONTAL; gridbag.setConstraints(scrollPaneC, c); input.add(scrollPaneC); JLabel label2 = new JLabel("GOAL clause:"); c.gridx = 0; c.gridy = 4; // c.weightx=1; c.gridwidth = 3; c.fill = GridBagConstraints.NONE; gridbag.setConstraints(label2, c); input.add(label2); c.gridx = 0; c.gridy = 5; c.gridwidth = 3; c.fill = GridBagConstraints.HORIZONTAL; gridbag.setConstraints(gl, c); input.add(gl); c.gridx = 0; c.gridy = 6; c.weightx = 0.3; c.gridwidth = 1; gridbag.setConstraints(compile, c); input.add(compile); compile.addActionListener(this); c.gridx = 1; c.gridy = 6; c.weightx = 0.3; c.gridwidth = 1; gridbag.setConstraints(compileG, c); input.add(compileG); compileG.addActionListener(this); c.gridx = 2; c.gridy = 6; c.weightx = 0.3; c.gridwidth = 1; gridbag.setConstraints(run, c); input.add(run); run.addActionListener(this); Color c1 = new Color(166, 209, 241); code.setBackground(c1); code.setAutoscrolls(true); code.setEditable(true); /* mb1 input.add(load); input.add(scrollPaneC); input.add(gl); */ input.setBorder(BorderFactory.createEtchedBorder()); }
/** The graphic handling and deployment. */ private void initComponents() { jDesktopPane1 = new javax.swing.JDesktopPane(); jInternalFrame1 = new javax.swing.JInternalFrame(); tf = new javax.swing.JTextField(); b1 = new javax.swing.JButton(); jInternalFrame3 = new javax.swing.JInternalFrame(); ta = new javax.swing.JTextArea(); jsp_ta = new javax.swing.JScrollPane(ta); jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); jMenuItem3 = new javax.swing.JMenuItem(); jSeparator1 = new javax.swing.JSeparator(); jMenuItem4 = new javax.swing.JMenuItem(); jInternalFrame1 .getContentPane() .setLayout( new javax.swing.BoxLayout( jInternalFrame1.getContentPane(), javax.swing.BoxLayout.X_AXIS)); jInternalFrame1.setIconifiable(true); jInternalFrame1.setMaximizable(true); jInternalFrame1.setResizable(true); jInternalFrame1.setTitle("Message editor"); jInternalFrame1.setToolTipText( "Move and resize all of these to make the chat room appearance match your preferences."); jInternalFrame1.setVisible(true); tf.setFont(new java.awt.Font("Lucida Sans", 0, 12)); jInternalFrame1.getContentPane().add(tf); b1.setText("Send Message"); jInternalFrame1.getContentPane().add(b1); jInternalFrame1.setBounds(10, 10, 440, 60); jDesktopPane1.add(jInternalFrame1, javax.swing.JLayeredPane.DEFAULT_LAYER); jInternalFrame3.setIconifiable(true); jInternalFrame3.setMaximizable(true); jInternalFrame3.setResizable(true); jInternalFrame3.setTitle("Messages"); jInternalFrame3.setToolTipText( "Move and resize all of these to make the chat room appearance match your preferences."); jInternalFrame3.setVisible(true); ta.setBackground(new Color(255, 255, 255)); ta.setEditable(false); ta.setFont(new java.awt.Font("Lucida Sans", 0, 12)); // jsp_ta.setAutoscrolls(true); jsp_ta.setDoubleBuffered(true); jInternalFrame3.getContentPane().add(jsp_ta, java.awt.BorderLayout.CENTER); jInternalFrame3.setBounds(10, 80, 420, 240); jDesktopPane1.add(jInternalFrame3, javax.swing.JLayeredPane.DEFAULT_LAYER); getContentPane().add(jDesktopPane1, java.awt.BorderLayout.CENTER); jMenu1.setText("Private room options"); jMenu1.setMnemonic(KeyEvent.VK_O); jMenu1.setToolTipText("Choose some options."); jMenuItem3.setText("Save conversation"); jMenuItem3.setMnemonic(KeyEvent.VK_S); jMenuItem3.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK)); jMenu1.add(jMenuItem3); jMenu1.add(jSeparator1); jMenuItem4.setText("Exit"); jMenuItem4.setMnemonic(KeyEvent.VK_E); jMenuItem4.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E, ActionEvent.CTRL_MASK)); jMenu1.add(jMenuItem4); jMenuBar1.add(jMenu1); setJMenuBar(jMenuBar1); this.pack(); b1.addActionListener(this); tf.addActionListener(this); jMenuItem3.addActionListener(this); jMenuItem4.addActionListener(this); posx = (int) Math.random() * 640; posy = (int) Math.random() * 480; this.pack(); this.setSize(dimx, dimy); this.setLocation(posx, posy); this.show(); }