public UnitListInternalFrame(String Title, Vector<Unit> units, UnitChangeListener ucl) { super(Title, true, true, true, true); m_UnitListPanel = new UnitListPanel(units); m_UnitListPanel.addUnitChangeListener(ucl); getContentPane().setLayout(new BorderLayout()); // m_UnitListPanel.setFocusable(false); getContentPane().add(m_UnitListPanel, BorderLayout.CENTER); m_ButtonPanel.setBorder(BorderFactory.createEtchedBorder()); m_ButtonPanel.setLayout(new BoxLayout(m_ButtonPanel, BoxLayout.X_AXIS)); m_NewButton.setAlignmentY(Component.CENTER_ALIGNMENT); m_NewButton.setActionCommand("New"); m_NewButton.addActionListener(this); m_RemoveButton.setAlignmentY(Component.CENTER_ALIGNMENT); m_RemoveButton.setActionCommand("Remove"); m_RemoveButton.addActionListener(this); m_EditButton.setAlignmentY(Component.CENTER_ALIGNMENT); m_EditButton.setActionCommand("Edit"); m_EditButton.addActionListener(this); m_ButtonPanel.add(m_NewButton); m_ButtonPanel.add(m_EditButton); m_ButtonPanel.add(Box.createHorizontalBox()); m_ButtonPanel.add(m_RemoveButton); m_ButtonPanel.add(Box.createHorizontalGlue()); getContentPane().add(m_ButtonPanel, BorderLayout.SOUTH); }
@Nullable @Override public JComponent createComponent() { myEnabled = new JBCheckBox("Enable EditorConfig support"); final JPanel result = new JPanel(); result.setLayout(new BoxLayout(result, BoxLayout.LINE_AXIS)); final JPanel panel = new JPanel(new VerticalFlowLayout()); result.setBorder(IdeBorderFactory.createTitledBorder("EditorConfig", false)); panel.add(myEnabled); final JLabel warning = new JLabel("EditorConfig may override the IDE code style settings"); warning.setFont(UIUtil.getLabelFont(UIUtil.FontSize.SMALL)); warning.setBorder(IdeBorderFactory.createEmptyBorder(0, 20, 0, 0)); panel.add(warning); panel.setAlignmentY(Component.TOP_ALIGNMENT); result.add(panel); final JButton export = new JButton("Export"); export.addActionListener( (event) -> { final Component parent = UIUtil.findUltimateParent(result); if (parent instanceof IdeFrame) { Utils.export(((IdeFrame) parent).getProject()); } }); export.setAlignmentY(Component.TOP_ALIGNMENT); result.add(export); return result; }
protected JToolBar createToolBar() { JToolBar jtoolbar = new JToolBar(); jtoolbar.putClientProperty("JToolBar.isRollover", Boolean.TRUE); // --------------------------------------- JButton jbuttonClear = new JButton("Clear SQL Statement"); jbuttonClear.setToolTipText("Clear SQL Statement"); jbuttonClear.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent actionevent) { clear(); } }); // --------------------------------------- JButton jbuttonExecute = new JButton("Execute SQL Statement"); jbuttonExecute.setToolTipText("Execute SQL Statement"); jbuttonExecute.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent actionevent) { execute(); } }); jtoolbar.addSeparator(); jtoolbar.add(jbuttonClear); jtoolbar.addSeparator(); jtoolbar.add(jbuttonExecute); jtoolbar.addSeparator(); jbuttonClear.setAlignmentY(0.5F); jbuttonClear.setAlignmentX(0.5F); jbuttonExecute.setAlignmentY(0.5F); jbuttonExecute.setAlignmentX(0.5F); return jtoolbar; }
/** Créer un pannel avec un bouton capâble de lançer la Proglet */ private static JPanel createShortcut( ImageIcon icon, String name, String title, final Runnable start) { JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.add(Box.createVerticalGlue()); JButton label = new JButton(name, icon); // Affichage du titre dans le charset de l'ordinateur label.setToolTipText(title); label.setPreferredSize(new Dimension(160, 160)); label.setVerticalTextPosition(JLabel.BOTTOM); label.setHorizontalTextPosition(JLabel.CENTER); label.setAlignmentX(Component.CENTER_ALIGNMENT); label.setAlignmentY(Component.CENTER_ALIGNMENT); panel.add(label); panel.add(Box.createVerticalGlue()); label.addMouseListener( new MouseListener() { @Override public void mouseClicked(MouseEvent e) { start.run(); } @Override public void mousePressed(MouseEvent e) {} @Override public void mouseReleased(MouseEvent e) {} @Override public void mouseEntered(MouseEvent e) {} @Override public void mouseExited(MouseEvent e) {} }); return panel; }
/** @throws IOException */ public void setting_panel() throws IOException { this.setTitle("Music World!!"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // the line that reads the image file // BufferedImage image = ImageIO.read(new File("icon.jpg")); // BufferedImage image = ImageIO.read(new File("C:/Users/Marium // Ahmad/work/P2P/GUI/ui/P2P/CT/icon.jpg")); this.setBounds(20, 20, 479, 483); // ImagePanel panel = new ImagePanel(new ImageIcon("C:/Users/Marium // Ahmad/work/P2P/GUI/ui/P2P/CT/background_image_music.jpg").getImage()); // ImagePanel panel = new ImagePanel(new ImageIcon("background_image_music.jpg").getImage()); /** * **************************************************************************************************************************************************** * Menu Bar * **************************************************************************************************************************************************** */ JMenuBar menuBar = new JMenuBar(); menuBar.setBackground(new Color(240, 240, 240)); setJMenuBar(menuBar); JMenu FileMenu = new JMenu("File"); FileMenu.setMnemonic('F'); menuBar.add(FileMenu); JMenuItem OpenMenuItem = new JMenuItem("Open..."); OpenMenuItem.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(); chooser.showOpenDialog(null); File file = chooser.getSelectedFile(); // file.getName().toLowerCase().endsWith(".mp3"); String filename = file.getName(); } }); FileMenu.add(OpenMenuItem); JMenuItem CloseMenu = new JMenuItem("Close"); FileMenu.add(CloseMenu); JMenuItem RPIMenu = new JMenuItem("Recently played item"); FileMenu.add(RPIMenu); JMenuItem ExitMenu = new JMenuItem("Exit"); ExitMenu.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { System.exit(0); } }); FileMenu.add(ExitMenu); JMenu HelpMenu = new JMenu("Help"); HelpMenu.setMnemonic('H'); menuBar.add(HelpMenu); JMenuItem AboutMenu = new JMenuItem("About"); HelpMenu.add(AboutMenu); JMenuItem ContentsMenu = new JMenuItem("Help Contents"); HelpMenu.add(ContentsMenu); /* * ************************************************************************************************************************************************** */ contentPane = new JPanel(); contentPane.setBackground(new Color(240, 240, 240)); contentPane.setBorder(UIManager.getBorder("MenuBar.border")); setContentPane(contentPane); /** * *************************************************************************************************************************************************** * Adding genre list choice * **************************************************************************************************************************************************** */ /* * Setting Fonts */ Font SansSerif = new Font("SansSerif", Font.PLAIN, 14); contentPane.setFont(SansSerif); JPanel panel_2 = new JPanel(); contentPane.add(panel_2); textField_2 = new JTextField(); textField_2.setColumns(10); JLabel lblAlbum = new JLabel("Album"); lblAlbum.setFont(new Font("Showcard Gothic", Font.PLAIN, 11)); GroupLayout gl_panel_2 = new GroupLayout(panel_2); gl_panel_2.setHorizontalGroup( gl_panel_2 .createParallelGroup(Alignment.LEADING) .addGroup( gl_panel_2 .createSequentialGroup() .addGroup( gl_panel_2 .createParallelGroup(Alignment.LEADING) .addGroup( gl_panel_2 .createSequentialGroup() .addGap(45) .addComponent(lblAlbum)) .addGroup( gl_panel_2 .createSequentialGroup() .addGap(16) .addComponent( textField_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) .addContainerGap(17, Short.MAX_VALUE))); gl_panel_2.setVerticalGroup( gl_panel_2 .createParallelGroup(Alignment.LEADING) .addGroup( gl_panel_2 .createSequentialGroup() .addGap(5) .addComponent( textField_2, GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(lblAlbum))); panel_2.setLayout(gl_panel_2); JPanel panel_1 = new JPanel(); contentPane.add(panel_1); textField = new JTextField(); textField.setColumns(10); JLabel lblGenre = new JLabel("Genre"); lblGenre.setFont(new Font("Showcard Gothic", Font.PLAIN, 11)); textField_1 = new JTextField(); textField_1.setColumns(10); JLabel lblArtist = new JLabel("Artist"); lblArtist.setFont(new Font("Showcard Gothic", Font.PLAIN, 11)); GroupLayout gl_panel_1 = new GroupLayout(panel_1); gl_panel_1.setHorizontalGroup( gl_panel_1 .createParallelGroup(Alignment.LEADING) .addGroup( gl_panel_1 .createSequentialGroup() .addGroup( gl_panel_1 .createParallelGroup(Alignment.LEADING) .addGroup( gl_panel_1 .createSequentialGroup() .addGap(45) .addComponent(lblGenre)) .addGroup( gl_panel_1 .createSequentialGroup() .addGap(46) .addComponent(lblArtist)) .addGroup( gl_panel_1 .createSequentialGroup() .addGap(16) .addComponent( textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGroup( gl_panel_1 .createSequentialGroup() .addGap(16) .addComponent( textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) .addContainerGap(17, Short.MAX_VALUE))); gl_panel_1.setVerticalGroup( gl_panel_1 .createParallelGroup(Alignment.LEADING) .addGroup( gl_panel_1 .createSequentialGroup() .addGap(5) .addComponent( textField, GroupLayout.PREFERRED_SIZE, 27, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(lblGenre) .addGap(5) .addComponent( textField_1, GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(lblArtist))); panel_1.setLayout(gl_panel_1); // String genre = chooser.getSelectedItem(); // logger.debug(genre); // chooser.addItemListener((ItemListener) this); /* Event.itemStateChanged(ItemEvent e) // { String result = chooser.getSelectedItem(); myTextField.setText("Your Choice: " + result); logger.debug(result); //} */ /* * ************************************************************************************************************************************************** */ /** * ************************************************************************************************************************************************** * Adding Button * ***************************************************************************************************************************************** */ Component glue_2 = Box.createGlue(); contentPane.add(glue_2); Component glue_4 = Box.createGlue(); contentPane.add(glue_4); Component glue_5 = Box.createGlue(); contentPane.add(glue_5); Component glue_6 = Box.createGlue(); contentPane.add(glue_6); Component glue_7 = Box.createGlue(); contentPane.add(glue_7); txtTypeGenrealbumartistName = new JTextField("Enter Song"); contentPane.add(txtTypeGenrealbumartistName); txtTypeGenrealbumartistName.setSelectionColor(SystemColor.controlLtHighlight); txtTypeGenrealbumartistName.setPreferredSize(new Dimension(100, 20)); txtTypeGenrealbumartistName.setBackground(SystemColor.activeCaption); txtTypeGenrealbumartistName.setForeground(new Color(102, 0, 204)); JButton Pause = new JButton(); Pause.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { // **********For pause Button } }); // **************This whole is for progress bar*********************************** // final LongTask task = new LongTask(); // int length = 0; // final JProgressBar progressBar = new JProgressBar(0,task.getLengthOfTask()); // progressBar.setValue(0); // progressBar.setStringPainted(true); // ********************************************************************************* JButton Play = new JButton(); Play.setAlignmentX(Component.RIGHT_ALIGNMENT); Play.setAlignmentY(Component.BOTTOM_ALIGNMENT); Play.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { // To Do from the recommender system if (txtTypeGenrealbumartistName.getText().equals("Enter Song")) JOptionPane.showMessageDialog(null, "Enter something in the textbox to play"); else { String UserInput = txtTypeGenrealbumartistName.getText(); logger.debug(UserInput); // TO DO "UserInput to the recommender system // **********************OBSERVABLE***************************** try { Thread.sleep(500); } catch (InterruptedException e2) { // TODO Auto-generated catch block e2.printStackTrace(); } // waiting for the input ObservableValue Observing_String = new ObservableValue(null); TextObserver Update_Value = new TextObserver(Observing_String); Observing_String.addObserver( Update_Value); /// *********************use as many observer as you want....If you // find difficulty just email me. // Debugging***************************************************************** // Observe observe = new Observe(); // ************************************************************************** /* * Creating a list for checking * Arrange the progressBar accordingly * */ String[] Check = new String[6]; Check[0] = "One"; // progressBar.setValue(2); Check[1] = "Two"; // progressBar.setValue(4); Check[2] = "Three"; // progressBar.setValue(6); Check[3] = "Four"; // progressBar.setValue(8); Check[4] = "Five"; // progressBar.setValue(10); Check[5] = "Six"; // logger.debug("here1"); for (int i = 0; i < Check.length; i++) { // logger.debug( Iter.next() ); Observing_String.setSong(Check[i]); /* * The updated value is shown in the text bars...here you will observe the same value as I took a single observer...rest of the thing is in email. */ textField.setText(Update_Value.GetValue()); textField_1.setText(Update_Value.GetValue()); textField_2.setText(Update_Value.GetValue()); try { Thread.sleep(2000); } catch (InterruptedException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } // DEBUGGING******************************************************************This is // used when you run it via Observe.java /*observe.startEngine(); try { Thread.sleep(3000); } catch (InterruptedException Check) { Check.printStackTrace(); } observe.stopEngine();*/ // Debugging******************************************************************* } } }); // contentPane.add(progressBar); THE ADDITION OF PROGRESS BAR! // Play.setIcon(new ImageIcon("C:\\Users\\Marium // Ahmad\\work\\P2P\\GUI\\ui\\P2P\\CT\\Button-Play-icon.png")); contentPane.add(Play); JButton Stop = new JButton(); Stop.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { // *************For stop button } }); Component glue = Box.createGlue(); contentPane.add(glue); Stop.setAlignmentX(Component.RIGHT_ALIGNMENT); Stop.setAlignmentY(Component.TOP_ALIGNMENT); // Stop.setIcon(new ImageIcon("C:\\Users\\Marium // Ahmad\\work\\P2P\\GUI\\ui\\P2P\\CT\\Button-Stop-icon.png")); contentPane.add(Stop); Pause.setAlignmentX(Component.RIGHT_ALIGNMENT); Pause.setAlignmentY(Component.TOP_ALIGNMENT); // Pause.setIcon(new ImageIcon("C:\\Users\\Marium // Ahmad\\work\\P2P\\GUI\\ui\\P2P\\CT\\Button-Pause-icon.png")); contentPane.add(Pause); JButton Skip = new JButton(); Skip.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { // *****For the Skip button } }); Component glue_1 = Box.createGlue(); contentPane.add(glue_1); // Skip.setIcon(new ImageIcon("C:\\Users\\Marium // Ahmad\\work\\P2P\\GUI\\ui\\P2P\\CT\\button_fast_forward_right_next_skip_button_bak_icon_go_arrow.png")); contentPane.add(Skip); /** * ************************************************************************************************************************************************** * Message display * ************************************************************************************************************************************************** */ ScrollPane scrollPane = new ScrollPane(); scrollPane.setForeground(Color.WHITE); scrollPane.setFont(new Font("Arial", Font.PLAIN, 12)); scrollPane.setBackground(Color.WHITE); // panel.add(scrollPane, BorderLayout.CENTER); }
/** This method is called from within the constructor to initialize the form. */ private void initComponents() { genCtrlPanel = new JPanel(); jPanel4 = new JPanel(); jPanel13 = new JPanel(); jPanel10 = new JPanel(); jLabel4 = new JLabel(); cbCatalog = new JComboBox(); jPanel8 = new JPanel(); jLabel1 = new JLabel(); cbCategory = new JComboBox(); jPanel14 = new JPanel(); jPanel11 = new JPanel(); generateButton = new JButton(); jPanel9 = new JPanel(); jLabel5 = new JLabel(); cbSex = new JComboBox(); jPanel7 = new JPanel(); jSeparator4 = new JSeparator(); jPanel12 = new JPanel(); jLabel6 = new JLabel(); cbStructure = new JComboBox(); chkStructure = new JCheckBox(); buttonPanel = new JPanel(); nameDisplayPanel = new JPanel(); nameSubInfoPanel = new JPanel(); jSeparator2 = new JSeparator(); jLabel2 = new JLabel(); meaning = new JLabel(); jSeparator1 = new JSeparator(); jLabel3 = new JLabel(); pronounciation = new JLabel(); jSeparator3 = new JSeparator(); namePanel = new JPanel(); name = new JTextField(); nameActionPanel = new JPanel(); jButton1 = new JButton(); setLayout(new BorderLayout(0, 5)); genCtrlPanel.setLayout(new BorderLayout()); jPanel4.setLayout(new BoxLayout(jPanel4, BoxLayout.X_AXIS)); jPanel13.setLayout(new BorderLayout()); jPanel10.setLayout(new FlowLayout(FlowLayout.LEFT)); jLabel4.setText(LanguageBundle.getString("in_rndNameCatalog")); // $NON-NLS-1$ jPanel10.add(jLabel4); cbCatalog.addActionListener(this::cbCatalogActionPerformed); jPanel10.add(cbCatalog); jPanel13.add(jPanel10, BorderLayout.CENTER); jPanel8.setLayout(new FlowLayout(FlowLayout.LEFT)); jLabel1.setText(LanguageBundle.getString("in_rndNameCategory")); // $NON-NLS-1$ jPanel8.add(jLabel1); cbCategory.addActionListener(this::cbCategoryActionPerformed); jPanel8.add(cbCategory); jPanel13.add(jPanel8, BorderLayout.NORTH); jPanel4.add(jPanel13); jPanel14.setLayout(new BorderLayout()); jPanel11.setLayout(new FlowLayout(FlowLayout.LEFT)); generateButton.setText(LanguageBundle.getString("in_rndNameGenerate")); // $NON-NLS-1$ generateButton.addActionListener(this::generateButtonActionPerformed); jPanel11.add(generateButton); jPanel14.add(jPanel11, BorderLayout.CENTER); jPanel9.setLayout(new FlowLayout(FlowLayout.LEFT)); jLabel5.setText(LanguageBundle.getString("in_rndNameSex")); // $NON-NLS-1$ jPanel9.add(jLabel5); cbSex.addActionListener(this::cbSexActionPerformed); jPanel9.add(cbSex); jPanel14.add(jPanel9, BorderLayout.NORTH); jPanel4.add(jPanel14); genCtrlPanel.add(jPanel4, BorderLayout.NORTH); jPanel7.setLayout(new BorderLayout()); jPanel7.add(jSeparator4, BorderLayout.NORTH); jPanel12.setLayout(new FlowLayout(FlowLayout.LEFT)); jLabel6.setText(LanguageBundle.getString("in_rndNameStructure")); // $NON-NLS-1$ jPanel12.add(jLabel6); cbStructure.setEnabled(false); cbStructure.addActionListener(this::cbStructureActionPerformed); jPanel12.add(cbStructure); chkStructure.setSelected(true); chkStructure.setText(LanguageBundle.getString("in_randomButton")); // $NON-NLS-1$ chkStructure.addActionListener(this::chkStructureActionPerformed); jPanel12.add(chkStructure); jPanel7.add(jPanel12, BorderLayout.CENTER); jPanel7.add(new JSeparator(), BorderLayout.SOUTH); JPanel adjustNamePanel = new JPanel(); adjustNamePanel.setLayout(new BorderLayout()); JLabel adjNameLabel = new JLabel(LanguageBundle.getString("in_rndNameAdjust")); // $NON-NLS-1$ adjustNamePanel.add(adjNameLabel, BorderLayout.NORTH); buttonPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); // CODE-2099 Component needed to have correct vertical space available. JLabel nb = new JLabel(" "); // $NON-NLS-1$ buttonPanel.add(nb); adjustNamePanel.add(buttonPanel, BorderLayout.CENTER); add(adjustNamePanel, BorderLayout.SOUTH); genCtrlPanel.add(jPanel7, BorderLayout.CENTER); // Name display nameDisplayPanel.setLayout(new BorderLayout()); nameSubInfoPanel.setLayout(new BoxLayout(nameSubInfoPanel, BoxLayout.Y_AXIS)); nameSubInfoPanel.add(jSeparator2); jLabel2.setText(LanguageBundle.getString("in_rndNameMeaning")); // $NON-NLS-1$ nameSubInfoPanel.add(jLabel2); meaning.setText(LanguageBundle.getString("in_rndNmDefault")); // $NON-NLS-1$ nameSubInfoPanel.add(meaning); nameSubInfoPanel.add(jSeparator1); jLabel3.setText(LanguageBundle.getString("in_rndNmPronounciation")); // $NON-NLS-1$ nameSubInfoPanel.add(jLabel3); pronounciation.setText("nAm"); nameSubInfoPanel.add(pronounciation); nameSubInfoPanel.add(jSeparator3); nameDisplayPanel.add(nameSubInfoPanel, BorderLayout.SOUTH); JLabel nameTitleLabel = new JLabel(LanguageBundle.getString("in_sumName")); // $NON-NLS-1$ JPanel nameTitlePanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); nameTitlePanel.add(nameTitleLabel); JPanel topPanel = new JPanel(); topPanel.setLayout(new BoxLayout(topPanel, BoxLayout.Y_AXIS)); namePanel.setLayout(new BoxLayout(namePanel, BoxLayout.X_AXIS)); FontManipulation.xxlarge(name); name.setText(LanguageBundle.getString("in_nameLabel")); // $NON-NLS-1$ namePanel.add(name); nameActionPanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); jButton1.setIcon(Icons.Copy16.getImageIcon()); jButton1.setAlignmentY(0.0F); jButton1.setIconTextGap(0); jButton1.setMargin(new Insets(2, 2, 2, 2)); jButton1.addActionListener(this::jButton1ActionPerformed); nameActionPanel.add(jButton1); namePanel.add(nameActionPanel); topPanel.add(genCtrlPanel); topPanel.add(nameTitlePanel); topPanel.add(namePanel); topPanel.add(nameDisplayPanel); add(topPanel, BorderLayout.NORTH); }