/** Inicializace základních komponent okna */ private void init() { krokLabel = new JLabel("Synchronizace s web aplikací"); Font pismo = new Font("Arial", Font.BOLD, 14); krokLabel.setFont(pismo); NacitaciOkno.add(krokLabel); krokLabel.setBounds(90, 10, 250, 20); startButton = new JButton("Načíst"); startButton.setActionCommand("start"); startButton.setBounds(250, 110, 120, 25); startButton.addActionListener(new Start()); progressBar = new JProgressBar(0, 100); progressBar.setBounds(20, 60, 350, 25); progressBar.setValue(0); progressBar.setStringPainted(true); taskOutput = new JTextArea(5, 20); taskOutput.setMargin(new Insets(5, 5, 5, 5)); taskOutput.setEditable(false); NacitaciOkno.add(startButton); NacitaciOkno.add(progressBar); NacitaciOkno.setVisible(true); vybratButton = new JButton("Otevřít"); NacitaciOkno.add(vybratButton); vybratButton.setBounds(20, 110, 120, 25); vybratButton.addActionListener(new Zpet()); }
private void setupGameRoomLobby() { gameRoomLobbyPanel.setLayout(new GridLayout(2, 2)); gameRoomLobbyPanel.add(newGameRoomButton); gameRoomLobbyPanel.add(joinGameRoomButton); gameRoomLobbyPanel.add(gameRoomLobbyLabel); gameRoomLobbyPanel.add(gameRoomsTable); newGameRoomButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { sendCommand(new NewGame()); showPanel(loadoutPanel); } }); joinGameRoomButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if (gameRoomsTable.getSelectedRow() >= 0) { gameTypeComboBox.setEnabled(false); mapTypeComboBox.setEnabled(false); sendCommand(new JoinGame(gameRoomsTable.getSelectedRow())); showPanel(loadoutPanel); } } }); }
/** Initialize the contents of the frame. */ private void initialize() { amountOfMoney.setText(Integer.toString(gameController.amountOfMoney)); numbersPanel.setLayout(new GridLayout(2, 5)); for (int i = 0; i < 10; i++) { buttons.add(new JButton(Integer.toString(i))); numbersPanel.add(buttons.get(i)); buttons.get(i).addActionListener(this); } numbersPanel.setPreferredSize(new Dimension(1000, 400)); inputsPanel.setLayout(new GridLayout(1, 5)); for (int i = 0; i < 4; i++) { answers.add(new JButton("")); inputsPanel.add(answers.get(i)); answers.get(i).setEnabled(false); } inputsPanel.add(deleteButton); deleteButton.addActionListener(this); submitButton.addActionListener(this); resultsPanel.setLayout(new GridLayout(2, 2)); // resultsPanel.add(moneyLabel); // resultsPanel.add(amountOfMoney); resultsPanel.add(resultLabel); resultsPanel.add(result); this.setLayout(new BorderLayout()); this.add(inputsPanel, BorderLayout.NORTH); this.add(numbersPanel, BorderLayout.CENTER); this.add(submitButton, BorderLayout.SOUTH); this.add(resultsPanel, BorderLayout.EAST); }
public void setActionListeners(ActionListener lis) { jbVer.addActionListener(lis); jbModif.addActionListener(lis); jbEliminar.addActionListener(lis); jbSalir.addActionListener(lis); jbBuscar.addActionListener(lis); }
public PostTestFrame() { setTitle("PostTest"); northPanel = new JPanel(); add(northPanel, BorderLayout.NORTH); northPanel.setLayout(new GridLayout(0, 2)); northPanel.add(new JLabel("Host: ", SwingConstants.TRAILING)); final JTextField hostField = new JTextField(); northPanel.add(hostField); northPanel.add(new JLabel("Action: ", SwingConstants.TRAILING)); final JTextField actionField = new JTextField(); northPanel.add(actionField); for (int i = 1; i <= 8; i++) northPanel.add(new JTextField()); final JTextArea result = new JTextArea(20, 40); add(new JScrollPane(result)); JPanel southPanel = new JPanel(); add(southPanel, BorderLayout.SOUTH); JButton addButton = new JButton("More"); southPanel.add(addButton); addButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { northPanel.add(new JTextField()); northPanel.add(new JTextField()); pack(); } }); JButton getButton = new JButton("Get"); southPanel.add(getButton); getButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { result.setText(""); final Map<String, String> post = new HashMap<String, String>(); for (int i = 4; i < northPanel.getComponentCount(); i += 2) { String name = ((JTextField) northPanel.getComponent(i)).getText(); if (name.length() > 0) { String value = ((JTextField) northPanel.getComponent(i + 1)).getText(); post.put(name, value); } } new SwingWorker<Void, Void>() { protected Void doInBackground() throws Exception { try { String urlString = hostField.getText() + "/" + actionField.getText(); result.setText(doPost(urlString, post)); } catch (IOException e) { result.setText("" + e); } return null; } }.execute(); } }); pack(); }
/** * The activation panel contains functions related to pausing, starting, and powering the steppers * up or down. */ protected JComponent createActivationPanel() { JPanel activationPanel = new JPanel(); activationPanel.setBorder(BorderFactory.createTitledBorder("Stepper Motor Controls")); activationPanel.setLayout(new BoxLayout(activationPanel, BoxLayout.LINE_AXIS)); // / Enable/disable steppers. JButton enableButton = new JButton("Enable"); enableButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { machine.runCommand(new replicatorg.drivers.commands.EnableDrives()); } }); activationPanel.add(enableButton); JButton disableButton = new JButton("Disable"); disableButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { machine.runCommand(new replicatorg.drivers.commands.DisableDrives()); } }); activationPanel.add(disableButton); activationPanel.add(Box.createHorizontalGlue()); return activationPanel; }
/** * The constructor for the SaveDialog class * * @param parent The LevelEditor class */ public SaveDialog(LevelEditor parent) { super(); le = parent; setTitle("SaveDialog"); setSize(DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT); setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); setLocationRelativeTo(null); setResizable(false); textField = new JTextField(10); String msgString1 = "Please enter filename:"; JLabel label = new JLabel(msgString1); JButton saveButton = new JButton(btnString1); saveButton.setActionCommand(btnString1); saveButton.addActionListener(this); JButton cancelButton = new JButton(btnString2); cancelButton.setActionCommand(btnString2); cancelButton.addActionListener(this); JPanel text = new JPanel(); text.setLayout(new BoxLayout(text, BoxLayout.Y_AXIS)); text.setSize(200, 40); text.add(label); text.add(textField); JPanel buttons = new JPanel(); buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS)); buttons.add(saveButton); buttons.add(cancelButton); add(text); add(buttons); setVisible(true); }
private void loadGUI() { setTitle("Chroma Key Sample"); panelBottom = new JPanel(); ButtonHandler l_buttonHandler = new ButtonHandler(); buttonCaptureBackground = new JButton("Capture Background"); buttonStart = new JButton("Start"); buttonStart.setEnabled(false); buttonCaptureBackground.addActionListener(l_buttonHandler); buttonStart.addActionListener(l_buttonHandler); sliderColorRange = new JSlider(JSlider.HORIZONTAL, 0, 50, 30); sliderColorRange.setMinorTickSpacing(1); sliderColorRange.setPaintTicks(true); sliderColorRange.addChangeListener(new SliderHandler()); labelColorRange = new JLabel("Color Range"); panelSlider = new JPanel(); panelSlider.add(labelColorRange); panelSlider.add(sliderColorRange); panelBottom.add(buttonCaptureBackground); panelBottom.add(buttonStart); Container l_container = getContentPane(); l_container.setLayout(new BorderLayout()); l_container.add(videoPanel, BorderLayout.NORTH); l_container.add(panelSlider, BorderLayout.CENTER); l_container.add(panelBottom, BorderLayout.SOUTH); setSize(videoInterface.getImageWidth(), videoInterface.getImageHeight() + 100); setVisible(true); }
private void initUI() { tblMain.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); refresh(); btAdd.addActionListener( e -> { PropertyForm.start(null); refresh(); }); btEdit.addActionListener(e -> editAction()); btRemove.addActionListener( e -> { Instance instance = ((InstanceTableModel) tblMain.getModel()).getItem(tblMain.getSelectedRow()); if (instance != null && !instance.isNew()) { int dialogButton = JOptionPane.YES_NO_OPTION; int dialogResult = JOptionPane.showConfirmDialog(null, "Remove row ?", "Confirm", dialogButton); if (dialogResult == 0) { ConfigHelper.getInstance().remove(instance); refresh(); } } }); btRun.addActionListener(e -> this.startLoad(this)); progressBar.setMinimum(0); progressBar.setStringPainted(true); tblMain.addMouseListener( new MouseAdapter() { public void mousePressed(MouseEvent me) { if (me.getClickCount() == 2) { editAction(); } } }); }
/** * Cria a interface grafica para o teste * * @param jLayerPausable objeto para o teste */ public static void interfaceGrafica(JLayerPausableTest jLayerPausable) { JFrame frame = new JFrame("Test JlayerPlayerPausable"); JButton buttonPlay = new JButton("Play"); JButton buttonPause = new JButton("Pause"); JButton buttonStop = new JButton("Stop"); JPanel panel = new JPanel(new GridBagLayout()); panel.add(buttonPlay); panel.add(buttonPause); panel.add(buttonStop); buttonPlay.addActionListener(new ButtonListener(jLayerPausable)); buttonPause.addActionListener(new ButtonListener(jLayerPausable)); buttonStop.addActionListener(new ButtonListener(jLayerPausable)); frame.add(panel); frame.setPreferredSize(new Dimension(200, 100)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); }
private void initComponents() { this.addWindowListener( new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent we) { System.exit(0); } }); java.awt.Container contentPane = this.getContentPane(); // Setup the empty module panel modulePanel.setLayout(new CardLayout()); contentPane.add(modulePanel); // Setup the button panel JPanel buttonPanel = new JPanel(); JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(this); buttonPanel.add(cancelButton); backButton.addActionListener(this); backButton.setEnabled(false); buttonPanel.add(backButton); nextButton.addActionListener(this); nextButton.setEnabled(false); buttonPanel.add(nextButton); finishButton.addActionListener(this); finishButton.setEnabled(false); buttonPanel.add(finishButton); contentPane.add(buttonPanel, "South"); }
private void LaunchEvents() { // cuando la ventana se abra, se cargan las imagen de una vez File folder = new File("C:\\Users\\AULA1\\Downloads\\icons"); for (File file : folder.listFiles()) { images.add(file.getAbsolutePath()); } viewer.setIcon(images.getCurrent()); // cuando se presiona el izquierdo left.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (images.goBack()) { viewer.setIcon(images.getCurrent()); } } }); // right.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { throw new UnsupportedOperationException( "Not supported yet."); // To change body of generated methods, choose Tools | // Templates. } }); }
public CurrentCustomerOrderDialog(ArrayList<Object[]> list) { scrollPane = new JScrollPane(); scrollPane.setMaximumSize(new Dimension(1024, 768)); scrollPane.setMinimumSize(new Dimension(800, 500)); createTable(list); contentPanePanel.setLayout(new MigLayout()); contentPanePanel.add(scrollPane, "push, grow"); JPanel panel = new JPanel(); panel.setLayout(new MigLayout()); panel.add(btnClearOrder, "wrap, growx"); contentPanePanel.add(panel, "pushx,wrap,alignx left, aligny top"); contentPanePanel.add(btnOk, "pushx, alignx center"); btnOk.addActionListener(this); btnClearOrder.addActionListener(this); setLayout(new GridBagLayout()); setContentPane(contentPanePanel); setModal(true); toFront(); setTitle("Current order"); pack(); setLocationRelativeTo(null); setVisible(true); }
public void confirmOrder(ArrayList<Object[]> list) { scrollPane = new JScrollPane(); scrollPane.setMaximumSize(new Dimension(1024, 768)); scrollPane.setMinimumSize(new Dimension(800, 500)); createTable(list); contentPanePanel.setLayout(new MigLayout()); JLabel lab = new JLabel("Is this Order complete?"); lab.setFont(new Font("Tahoma", Font.PLAIN, 20)); lab.setForeground(Color.orange); contentPanePanel.add(lab, "pushx,alignx center,span,wrap"); contentPanePanel.add(scrollPane, "push, grow, span, wrap"); contentPanePanel.add(btnCancel, "pushx, alignx right"); contentPanePanel.add(btnOrder, "pushx, alignx left"); btnCancel.addActionListener(this); btnOrder.addActionListener(this); setLayout(new GridBagLayout()); setContentPane(contentPanePanel); setModal(true); setTitle("Order confirmation"); toFront(); pack(); setLocationRelativeTo(null); setVisible(true); }
public CollageList() { super(); actionComponent = new Button(); Panel toolBar; setLayout(new BorderLayout()); // ggHScroll = new Scrollbar( Scrollbar.HORIZONTAL, 0, 0x8000, 0, 0x8000 ); ggVScroll = new Scrollbar(Scrollbar.VERTICAL, 0, 0x8000, 0, 0x8000); // ggHScroll.addAdjustmentListener( ggCurve ); ggVScroll.addAdjustmentListener(this); toolBar = new Panel(); toolBar.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 2)); ggAdd = new JButton(" Add "); ggDel = new JButton(" Delete "); ggDup = new JButton(" Duplicate "); ggAdd.addActionListener(this); ggDel.addActionListener(this); ggDup.addActionListener(this); toolBar.add(ggAdd); toolBar.add(ggDel); toolBar.add(ggDup); add(toolBar, BorderLayout.NORTH); // add( ggHScroll, BorderLayout.SOUTH ); add(ggVScroll, BorderLayout.EAST); add(new CollageCanvas(this), BorderLayout.CENTER); // add( ggCurve, BorderLayout.CENTER ); }
/** * builds and displays the frame without the colored fractal; registers the buttons; sets size, * location, close operation; calls changeFractal() */ private void makeWindow() { // set size and location setSize(740, 800); setLocation(100, 0); // specify close button action setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // instantiate panel panelNorth = new JPanel(); // instantiate buttons and register action listener up = new JButton("level up"); down = new JButton("level down"); up.addActionListener(this); down.addActionListener(this); // set layout setLayout(new BorderLayout(10, 10)); // add panel to frame and buttons to panel add(panelNorth, BorderLayout.NORTH); panelNorth.add(up); panelNorth.add(down); // call changeFractal changeFractal(); }
private void init() { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); contentPane.setPreferredSize(new Dimension(screenSize.width / 2, screenSize.height / 3)); setContentPane(contentPane); contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS)); buttonBar.setLayout(new FlowLayout()); buttonBarGrid.setLayout(new FlowLayout()); JButton cancelButton = new JButton(); JButton okButton = new JButton(); okButton.setText("OK"); okButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { onOk(); } }); cancelButton.setText("CANCEL"); cancelButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { onCancel(); } }); buttonBarGrid.add(okButton); buttonBarGrid.add(cancelButton); buttonBar.add(buttonBarGrid); controlsPanel.setLayout(new BoxLayout(controlsPanel, BoxLayout.X_AXIS)); controlsPanel.add(createTab()); contentPane.add(controlsPanel, BorderLayout.NORTH); contentPane.add(buttonBar, BorderLayout.SOUTH); }
public void constructMailPanel() { JPanel globalPanel = new JPanel(); globalPanel.setLayout(new BoxLayout(globalPanel, BoxLayout.Y_AXIS)); globalPanel.setVisible(true); JLabel nameLabel = new JLabel(name); nameLabel.setFont(new Font("Serif", Font.PLAIN, 30)); globalPanel.add(nameLabel); this.add(globalPanel); followButton = new JButton("Follow/UnFollow"); followButton.addActionListener(this); globalPanel.add(followButton); newMessage = new JButton("Write"); newMessage.addActionListener(this); globalPanel.add(newMessage); messagePanel = new JPanel(); messagePanel.setLayout(new BoxLayout(messagePanel, BoxLayout.Y_AXIS)); JScrollPane scrollPane = new JScrollPane(messagePanel); scrollPane.setPreferredSize(new Dimension(500, 400)); globalPanel.add(scrollPane); }
public DialogView(JFrame parent, String item, int position, String property) { super(parent, "Legend", true); this.addWindowListener(new CloseHandler()); itemType = item; itemPosition = position; detailProperty = property; String message = "Which " + item + " would you like to replace?"; messagePane.add(new JLabel(message)); getContentPane().add(messagePane); buttonPane.add(buttonLeft, BorderLayout.WEST); buttonPane.add(buttonRight, BorderLayout.EAST); buttonLeft.addActionListener(this); buttonRight.addActionListener(this); getContentPane().add(buttonPane, BorderLayout.SOUTH); setDefaultCloseOperation(DISPOSE_ON_CLOSE); pack(); if (parent != null) { Dimension parentSize = parent.getSize(); Dimension dialogSize = this.getSize(); Point p = parent.getLocation(); setLocation( p.x + parentSize.width / 2 - dialogSize.width / 2, p.y + parentSize.height / 2 - dialogSize.height / 2); } setTitle("Legend"); setVisible(true); }
public Initialize() { setTitle(""); setSize(400, 300); setLocationRelativeTo(null); JPanel p = new JPanel(); p.setLayout(new GridLayout(3, 2)); typel = new JLabel("Animal Type:"); typef = new JComboBox(); typef.addItem("Cow"); typef.addItem("Deer"); typef.addItem("Horse"); tot_popl = new JLabel("Initial population:"); tot_pop = new JTextField(12); annuler = new JButton("Cancel"); validate = new JButton("Create"); annuler.addActionListener(this); validate.addActionListener(this); p.add(typel); p.add(typef); p.add(tot_popl); p.add(tot_pop); p.add(annuler); p.add(validate); setContentPane(p); this.pack(); // bien regrouper les éléments }
public ShiftEntryDialog(Shift shift) { super(Application.getInstance().getBackOfficeWindow(), true); setTitle(com.floreantpos.POSConstants.NEW_SHIFT); setContentPane(contentPane); getRootPane().setDefaultButton(buttonOK); hours = new Vector<Integer>(); for (int i = 1; i <= 12; i++) { hours.add(Integer.valueOf(i)); } mins = new Vector<Integer>(); for (int i = 0; i < 60; i++) { mins.add(Integer.valueOf(i)); } startHour.setModel(new DefaultComboBoxModel(hours)); endHour.setModel(new DefaultComboBoxModel(hours)); startMin.setModel(new DefaultComboBoxModel(mins)); endMin.setModel(new DefaultComboBoxModel(mins)); buttonOK.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { onOK(); } }); buttonCancel.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { onCancel(); } }); // call onCancel() when cross is clicked setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { onCancel(); } }); // call onCancel() on ESCAPE contentPane.registerKeyboardAction( new ActionListener() { public void actionPerformed(ActionEvent e) { onCancel(); } }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); setSize(350, 250); setShift(shift); }
/** * Returns the Save and Canvel button. * * @return Save and Canvel button */ protected JComponent getSouthComponent() { JPanel panel = new JPanel(new FlowLayout(FlowLayout.TRAILING)); // save button saveButton = new JButton(saveAction); saveButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { saveFile(); undoManager.reset(); saveAction.setEnabled(false); } }); panel.add(saveButton); // close button JButton closeButton = new JButton(getLocalizer().localize("button.close")); closeButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { FileEditor.this.dispose(); } }); panel.add(closeButton); return new TwoComponentsPanel(lineCounter, panel); }
public UpgradesPanel(ORUIManager orUIManager) { super(BoxLayout.Y_AXIS); this.orUIManager = orUIManager; preferredSize = new Dimension((int) Math.round(100 * (2 + Scale.getFontScale()) / 3), 200); setSize(preferredSize); setVisible(true); upgradePanel = new JPanel(); upgradePanel.setOpaque(true); upgradePanel.setBackground(Color.DARK_GRAY); upgradePanel.setBorder(border); upgradePanel.setLayout(new GridLayout(defaultNbPanelElements, 1)); scrollPane = new JScrollPane(upgradePanel); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setSize(getPreferredSize()); doneButton.setActionCommand("Done"); doneButton.setMnemonic(KeyEvent.VK_D); doneButton.addActionListener(this); cancelButton.setActionCommand("Cancel"); cancelButton.setMnemonic(KeyEvent.VK_C); cancelButton.addActionListener(this); add(scrollPane); }
public CreInvChecker(Component parent) { typeButtons = new JCheckBox[CHECKTYPES.length]; JPanel boxPanel = new JPanel(new GridLayout(0, 1)); for (int i = 0; i < typeButtons.length; i++) { typeButtons[i] = new JCheckBox(CHECKTYPES[i], true); boxPanel.add(typeButtons[i]); } bstart.setMnemonic('s'); bcancel.setMnemonic('c'); bstart.addActionListener(this); bcancel.addActionListener(this); selectframe.getRootPane().setDefaultButton(bstart); selectframe.setIconImage(Icons.getIcon("Find16.gif").getImage()); boxPanel.setBorder(BorderFactory.createTitledBorder("Select test to check:")); JPanel bpanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); bpanel.add(bstart); bpanel.add(bcancel); JPanel mainpanel = new JPanel(new BorderLayout()); mainpanel.add(boxPanel, BorderLayout.CENTER); mainpanel.add(bpanel, BorderLayout.SOUTH); mainpanel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); JPanel pane = (JPanel) selectframe.getContentPane(); pane.setLayout(new BorderLayout()); pane.add(mainpanel, BorderLayout.CENTER); selectframe.pack(); Center.center(selectframe, parent.getBounds()); selectframe.setVisible(true); }
private void initComponents() { addButton = new JButton(rb.getString("Button.Add")); addButton.setIcon(IconUtils.getIcon("/jgnash/resource/list-add.png")); addButton.setHorizontalTextPosition(SwingConstants.LEADING); removeButton = new JButton(rb.getString("Button.Remove")); removeButton.setIcon(IconUtils.getIcon("/jgnash/resource/list-remove.png")); aJList = new JList<>(); cJList = new JList<>(); helpPane = new JEditorPane(); helpPane.setEditable(false); helpPane.setEditorKit(new StyledEditorKit()); helpPane.setBackground(getBackground()); helpPane.setText(TextResource.getString("NewFileThree.txt")); addComponentListener( new ComponentAdapter() { @Override public void componentHidden(ComponentEvent evt) { isPageValid(); } }); addButton.addActionListener(this); removeButton.addActionListener(this); }
// Audio recording\mixing private void audioEditor() { audioStudio.setLayout(null); record = new JButton("Record"); record.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); record.setToolTipText("Record Audio"); record.setBounds((width / 2) - 160, 0, 80, 25); audioStudio.add(record); audioStudio.add(audioformat); audioformat.setBounds(0, 0, 80, 25); audioformat.add("Wav"); audioformat.add("AIFC"); audioformat.add("AIFF"); audioformat.add("AU"); audioformat.add("SND"); audioStudio.add(sampleRate); sampleRate.setBounds(80, 0, 80, 25); sampleRate.add("8000"); sampleRate.add("11025"); sampleRate.add("16000"); sampleRate.add("22050"); sampleRate.add("44100"); audioStudio.add(channels); channels.setBounds(160, 0, 80, 25); channels.add("Mono"); channels.add("Stereo"); playaudio = new JButton("Play"); playaudio.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); playaudio.setToolTipText("Play recording"); playaudio.setBounds((width / 2), 0, 80, 25); audioStudio.add(playaudio); stopBtn = new JButton("Stop"); stopBtn.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); stopBtn.setToolTipText("Stop Recording"); stopBtn.setBounds((width / 2) - 80, 0, 80, 25); audioStudio.add(stopBtn); record.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { audio.captureAudio(); System.out.println(audio.getAudioFormat().getSampleRate()); System.out.println(audio.getAudioFormat().getChannels()); audio.audnum++; } }); stopBtn.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { audio.targetDataLine.stop(); audio.targetDataLine.close(); } }); }
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); }
private JPanel createButtonPanel() { JPanel parentPanel = new JPanel(new BorderLayout()); parentPanel.add(new JSeparator(SwingConstants.HORIZONTAL), BorderLayout.NORTH); JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.TRAILING)); JButton cancelButton = new JButton("Cancel"); buttonPanel.add(cancelButton); cancelButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { dispose(); } }); JButton createButton = new JButton("Create Thematic Map"); buttonPanel.add(createButton); createButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { generateThematicMap(); } }); parentPanel.add(buttonPanel, BorderLayout.CENTER); return parentPanel; }
public MainInterface() { super(); setBackground(new Color(245, 255, 250)); setLayout(null); setSize(400, 400); setBounds(70, 80, 400, 290); // setBounds(100, 150, 400, 300); setVisible(true); setBorder(new LineBorder(Color.GREEN, 3, true)); registerstudent = new JButton(); registerstudent.setText("REGISTER STUDENTS"); registerstudent.setBounds(80, 30, 230, 25); registerstudent.addActionListener(this); add(registerstudent); viewStudentPlofile = new JButton(); viewStudentPlofile.setText("VIEW STUDENTS PROFILE"); viewStudentPlofile.setBounds(80, 120, 230, 25); viewStudentPlofile.addActionListener(this); add(viewStudentPlofile); adminstration = new JButton(); adminstration.setText("FEE ADMINISTRATION "); adminstration.setBounds(80, 200, 230, 25); adminstration.addActionListener(this); add(adminstration); }
private void initComponents() { accountNumberField = new JTextFieldEx(); accountCodeField = new JIntegerField(); nameField = new JTextFieldEx(); bankIdField = new JTextFieldEx(); nameField.setText(rb.getString("Word.Name")); descriptionField = new JTextFieldEx(); descriptionField.setText(rb.getString("Word.Description")); currencyCombo = new CurrencyComboBox(); securityButton = new JButton(rb.getString("Word.None")); // for preferred width so button does not force a wide layout securityButton.setPreferredSize(new Dimension(20, securityButton.getPreferredSize().height)); accountTypeModel = new DefaultComboBoxModel<>(AccountType.values()); accountTypeModel.removeElement(AccountType.ROOT); accountTypeCombo = new JComboBox<>(accountTypeModel); lockedCheckBox = new JCheckBox(rb.getString("Button.Locked")); placeholderCheckBox = new JCheckBox(rb.getString("Button.PlaceHolder")); hideCheckBox = new JCheckBox(rb.getString("Button.HideAccount")); excludeBudgetCheckBox = new JCheckBox(rb.getString("Button.ExcludeFromBudget")); parentButton = new JButton("Root"); notesArea = new javax.swing.JTextArea(); notesArea.setLineWrap(true); notesArea.setAutoscrolls(false); notesArea.setPreferredSize(new java.awt.Dimension(100, 80)); accountTypeCombo.addActionListener(this); securityButton.addActionListener(this); parentButton.addActionListener(this); }