/** * @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 initUI() { // Create tabbed pane with commands in it tabbedPane = new JTabbedPane(); getContentPane().add(tabbedPane, BorderLayout.NORTH); tabbedPane.addTab("Book", null, createBookPane(), "View book information"); tabbedPane.addTab("Author", null, createAuthorPane(), "View author information"); tabbedPane.addTab("Customer", null, createCustomerPane(), "View customer information"); tabbedPane.addTab("Borrow Book", null, createBorrowPane(), "Borrow books for a customer"); tabbedPane.addTab("Return Book", null, createReturnPane(), "Return books for a customer"); // Create output area with scrollpane outputArea = new JTextArea(); // outputArea.setFont(new Font("Monospaced",Font.PLAIN,12)); outputArea.setFont(new Font("Monospaced", Font.ROMAN_BASELINE, 12)); outputArea.setEditable(false); outputArea.setFocusable(false); outputArea.setTabSize(2); JScrollPane sp = new JScrollPane(outputArea); sp.setVerticalScrollBarPolicy(VERTICAL_SCROLLBAR_ALWAYS); getContentPane().add(sp, BorderLayout.CENTER); // Create menus JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic('F'); JMenuItem clearTextMenuItem = new JMenuItem(clearTextAction); JMenuItem exitMenuItem = new JMenuItem(exitAction); fileMenu.add(clearTextMenuItem); fileMenu.addSeparator(); fileMenu.add(exitMenuItem); JMenuBar menuBar = new JMenuBar(); menuBar.add(fileMenu); setJMenuBar(menuBar); // Pack it all pack(); }
// initializes the internal component of the translator protected void jbInit() { this.getContentPane().setLayout(new GridBagLayout()); loadButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { loadButton_actionPerformed(e); } }); loadButton.setMaximumSize(new Dimension(39, 39)); loadButton.setMinimumSize(new Dimension(39, 39)); loadButton.setPreferredSize(new Dimension(39, 39)); loadButton.setSize(new Dimension(39, 39)); loadButton.setToolTipText("Load Source File"); loadButton.setIcon(loadIcon); saveButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { saveButton_actionPerformed(e); } }); saveButton.setMaximumSize(new Dimension(39, 39)); saveButton.setMinimumSize(new Dimension(39, 39)); saveButton.setPreferredSize(new Dimension(39, 39)); saveButton.setSize(new Dimension(39, 39)); saveButton.setToolTipText("Save Destination File"); saveButton.setIcon(saveIcon); singleStepButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { singleStepButton_actionPerformed(e); } }); singleStepButton.setMaximumSize(new Dimension(39, 39)); singleStepButton.setMinimumSize(new Dimension(39, 39)); singleStepButton.setPreferredSize(new Dimension(39, 39)); singleStepButton.setSize(new Dimension(39, 39)); singleStepButton.setToolTipText("Single Step"); singleStepButton.setIcon(singleStepIcon); ffwdButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { ffwdButton_actionPerformed(e); } }); ffwdButton.setMaximumSize(new Dimension(39, 39)); ffwdButton.setMinimumSize(new Dimension(39, 39)); ffwdButton.setPreferredSize(new Dimension(39, 39)); ffwdButton.setSize(new Dimension(39, 39)); ffwdButton.setToolTipText("Fast Forward"); ffwdButton.setIcon(ffwdIcon); rewindButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { rewindButton_actionPerformed(e); } }); rewindButton.setMaximumSize(new Dimension(39, 39)); rewindButton.setMinimumSize(new Dimension(39, 39)); rewindButton.setPreferredSize(new Dimension(39, 39)); rewindButton.setSize(new Dimension(39, 39)); rewindButton.setToolTipText("Rewind"); rewindButton.setIcon(rewindIcon); stopButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { stopButton_actionPerformed(e); } }); stopButton.setMaximumSize(new Dimension(39, 39)); stopButton.setMinimumSize(new Dimension(39, 39)); stopButton.setPreferredSize(new Dimension(39, 39)); stopButton.setSize(new Dimension(39, 39)); stopButton.setToolTipText("Stop"); stopButton.setIcon(stopIcon); fullTranslationButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { fullTranslationButton_actionPerformed(e); } }); fullTranslationButton.setMaximumSize(new Dimension(39, 39)); fullTranslationButton.setMinimumSize(new Dimension(39, 39)); fullTranslationButton.setPreferredSize(new Dimension(39, 39)); fullTranslationButton.setSize(new Dimension(39, 39)); fullTranslationButton.setToolTipText("Fast Translation"); fullTranslationButton.setIcon(fullTranslationIcon); messageLbl.setFont(Utilities.statusLineFont); messageLbl.setLineWrap(true); messageLbl.setEditable(false); messageLbl.setCursor(null); messageLbl.setOpaque(false); messageLbl.setFocusable(false); messageLblPane.setBorder(BorderFactory.createLoweredBevelBorder()); // messageLblPane.setBounds(new Rectangle(0, 672, TRANSLATOR_WIDTH - 8, 20)); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.ipadx = 0; c.ipady = 0; c.weightx = 1; c.weighty = 0; c.gridwidth = 3; c.anchor = GridBagConstraints.CENTER; c.gridx = 0; c.gridy = 2; this.getContentPane().add(messageLblPane, c); // arrowLabel.setBounds(new Rectangle(290, 324, 88, 71)); arrowLabel.setIcon(arrowIcon); // source.setVisibleRows(31); // destination.setVisibleRows(31); // source.setBounds(new Rectangle(35,100,source.getWidth(),source.getHeight())); // destination.setBounds(new Rectangle(375,100,destination.getWidth(),destination.getHeight())); c.fill = GridBagConstraints.BOTH; c.ipadx = 0; c.ipady = 0; c.weightx = 1; c.weighty = 1; c.gridwidth = 1; c.anchor = GridBagConstraints.CENTER; c.gridx = 0; c.gridy = 1; this.getContentPane().add(source, c); c.fill = GridBagConstraints.NONE; c.ipadx = 0; c.ipady = 0; c.weightx = 0; c.weighty = 0; c.gridwidth = 1; c.anchor = GridBagConstraints.CENTER; c.gridx = 1; c.gridy = 1; this.getContentPane().add(arrowLabel, c); c.fill = GridBagConstraints.BOTH; c.ipadx = 0; c.ipady = 0; c.weightx = 1; c.weighty = 1; c.gridwidth = 1; c.anchor = GridBagConstraints.CENTER; c.gridx = 2; c.gridy = 1; this.getContentPane().add(destination, c); // Adding the tool bar to this container. toolBar.setFloatable(false); toolBar.setLocation(0, 0); toolBar.setLayout(new FlowLayout(FlowLayout.LEFT, 3, 0)); toolBar.setBorder(BorderFactory.createEtchedBorder()); arrangeToolBar(); c.fill = GridBagConstraints.HORIZONTAL; c.ipadx = 0; c.ipady = 0; c.weightx = 1; c.weighty = 0; c.gridwidth = 3; c.anchor = GridBagConstraints.CENTER; c.gridx = 0; c.gridy = 0; this.getContentPane().add(toolBar, c); toolBar.revalidate(); toolBar.repaint(); repaint(); // Creating the menu bar arrangeMenu(); setJMenuBar(menuBar); // initializing the window size and visibility setDefaultCloseOperation(3); setSize(new Dimension(TRANSLATOR_WIDTH, TRANSLATOR_HEIGHT)); setVisible(true); }
/** initiate panel */ private void init() { txaHint = new JTextArea(); txaHint.setBorder(null); txaHint.setFocusable(false); txaHint.setLineWrap(true); txaHint.setWrapStyleWord(true); txaHint.setOpaque(false); btnHint = new JButton("Hint >>"); btnHint.setBorder(new EmptyBorder(new Insets(0, 0, 0, 0))); txtClassDir = new JTextField(); butSelect = new JButton("Browse.."); chkBoxIncludeClass = new JCheckBox("include .class file only"); chkBoxArchiveType = new JCheckBox("Select for Service Group Archive"); setBackButtonEnabled(true); setFinishButtonEnabled(false); setPageComplete(false); this.setLayout(new GridBagLayout()); this.add( new JLabel("Class file location"), new GridBagConstraints( 0, 0, 1, 1, 0.1, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 10, 0, 0), 0, 0)); this.add( txtClassDir, new GridBagConstraints( 1, 0, GridBagConstraints.RELATIVE, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 1, 1, 1), 0, 0)); txtClassDir.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { update(); } }); this.add( butSelect, new GridBagConstraints( 2, 0, 1, 1, 0.1, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 1, 1, 10), 0, 0)); butSelect.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int returnVal = fileChooser.showOpenDialog(butSelect); if (returnVal == JFileChooser.APPROVE_OPTION) { file = fileChooser.getSelectedFile(); fileChooser.setCurrentDirectory(file); txtClassDir.setText(file.getAbsolutePath()); setPageComplete(true); setNextButtonEnabled(true); } else { txtClassDir.setText(""); } update(); } }); this.add( chkBoxIncludeClass, new GridBagConstraints( 0, 1, GridBagConstraints.REMAINDER, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 10, 1, 1), 0, 0)); chkBoxIncludeClass.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { update(); } }); // this.add(chkBoxArchiveType // , new GridBagConstraints(0, 2, GridBagConstraints.REMAINDER, 1, 0.0, 0.0 // , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL // , new Insets(5, 10, 1,1), 0, 0)); // chkBoxArchiveType .addActionListener(new ActionListener() { // public void actionPerformed(ActionEvent e) { // update(); // } // }); this.add( btnHint, new GridBagConstraints( 0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 10, 0, 10), 0, 0)); btnHint.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if (flag) { btnHint.setText("Hint >>"); txaHint.setText(""); flag = false; } else { btnHint.setText("Hint <<"); txaHint.setText(hint); flag = true; } update(); } }); this.add( txaHint, new GridBagConstraints( 0, 3, GridBagConstraints.REMAINDER, 1, 0.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 10, 10, 10), 0, 0)); }
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); }