List of usage examples for java.awt BorderLayout WEST
String WEST
To view the source code for java.awt BorderLayout WEST.
Click Source Link
From source file:nz.ac.waikato.cms.supernova.gui.Supernova.java
/** * Creates the panel for batch generation. * * @return the panel/* w ww . j av a 2s . c o m*/ */ protected BasePanel createBatchPanel() { BasePanel result; JPanel params; JPanel left1; JPanel left2; JPanel panel; result = new BasePanel(new BorderLayout()); m_BatchLog = new JTextArea(20, 40); m_BatchLog.setFont(Font.decode("Monospaced-PLAIN-12")); result.add(new BaseScrollPane(m_BatchLog), BorderLayout.CENTER); left1 = new JPanel(new BorderLayout()); result.add(left1, BorderLayout.WEST); // params with height 2 params = new JPanel(new GridLayout(0, 1)); left1.add(params, BorderLayout.NORTH); m_BatchColors = new ColorTable(); left1.add(new BaseScrollPane(m_BatchColors), BorderLayout.NORTH); // params with height 1 panel = new JPanel(new BorderLayout()); left1.add(panel, BorderLayout.CENTER); left2 = new JPanel(new BorderLayout()); panel.add(left2, BorderLayout.NORTH); params = new JPanel(new GridLayout(0, 1)); left2.add(params, BorderLayout.NORTH); // background m_BatchBackground = new ColorButton(Color.BLACK); params.add(createParameter("Background", m_BatchBackground)); // opacity m_BatchOpacity = new JSpinner(); m_BatchOpacity.setValue(10); ((SpinnerNumberModel) m_BatchOpacity.getModel()).setMinimum(0); ((SpinnerNumberModel) m_BatchOpacity.getModel()).setMaximum(100); ((SpinnerNumberModel) m_BatchOpacity.getModel()).setStepSize(10); ((JSpinner.DefaultEditor) m_BatchOpacity.getEditor()).getTextField().setColumns(5); params.add(createParameter("Opacity %", m_BatchOpacity)); // margin m_BatchMargin = new JSpinner(); m_BatchMargin.setValue(20); ((SpinnerNumberModel) m_BatchMargin.getModel()).setMinimum(0); ((SpinnerNumberModel) m_BatchMargin.getModel()).setMaximum(100); ((SpinnerNumberModel) m_BatchMargin.getModel()).setStepSize(10); ((JSpinner.DefaultEditor) m_BatchMargin.getEditor()).getTextField().setColumns(5); params.add(createParameter("Margin %", m_BatchMargin)); // width m_BatchWidth = new JSpinner(); m_BatchWidth.setValue(400); ((SpinnerNumberModel) m_BatchWidth.getModel()).setMinimum(1); ((SpinnerNumberModel) m_BatchWidth.getModel()).setStepSize(100); ((JSpinner.DefaultEditor) m_BatchWidth.getEditor()).getTextField().setColumns(5); params.add(createParameter("Width", m_BatchWidth)); // height m_BatchHeight = new JSpinner(); m_BatchHeight.setValue(400); ((SpinnerNumberModel) m_BatchHeight.getModel()).setMinimum(1); ((SpinnerNumberModel) m_BatchHeight.getModel()).setStepSize(100); ((JSpinner.DefaultEditor) m_BatchHeight.getEditor()).getTextField().setColumns(5); params.add(createParameter("Height", m_BatchHeight)); // generator m_BatchGenerator = new JComboBox<>(Registry.toStringArray(Registry.getGenerators(), true)); params.add(createParameter("Generator", m_BatchGenerator)); // center m_BatchCenter = new JComboBox<>(Registry.toStringArray(Registry.getCenters(), true)); params.add(createParameter("Center", m_BatchCenter)); // csv m_BatchCSV = new FileChooserPanel(); m_BatchCSV.addChoosableFileFilter(new ExtensionFileFilter("CSV files", "csv")); m_BatchCSV.setPreferredSize(new Dimension(170, (int) m_BatchCSV.getPreferredSize().getHeight())); params.add(createParameter("CSV", m_BatchCSV)); // output m_BatchOutput = new DirectoryChooserPanel(); m_BatchOutput.setPreferredSize(new Dimension(170, (int) m_BatchOutput.getPreferredSize().getHeight())); params.add(createParameter("Output", m_BatchOutput)); // generate panel = new JPanel(new FlowLayout(FlowLayout.LEFT)); m_BatchGenerate = new JButton("Generate"); m_BatchGenerate.addActionListener((ActionEvent e) -> { SwingWorker worker = new SwingWorker() { @Override protected Object doInBackground() throws Exception { generateBatchOutput(); return null; } }; worker.execute(); }); panel.add(m_BatchGenerate); params.add(panel); adjustLabels(); return result; }
From source file:edu.clemson.cs.nestbed.client.gui.TestbedManagerFrame.java
private final JPanel buildConfigurationPanel() { JPanel configPanel = new JPanel(new BorderLayout()); configPanel.setBorder(new TitledBorder("Configurations")); // --- left-side ------------------------------------------------- JPanel sidePanel = new JPanel(new BorderLayout()); sidePanel.setPreferredSize(new Dimension(WINDOW_WIDTH / 3, SIZE_IGNORED)); configurationList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); configurationList.addListSelectionListener(new ConfigListSelectionListener()); sidePanel.add(new JScrollPane(configurationList), BorderLayout.CENTER); configPanel.add(sidePanel, BorderLayout.WEST); // --- right-side ------------------------------------------------ sidePanel = new JPanel(new BorderLayout()); sidePanel.setPreferredSize(new Dimension(310, SIZE_IGNORED)); JPanel rsTopPanel = new JPanel(new BorderLayout()); rsTopPanel.setPreferredSize(new Dimension(SIZE_IGNORED, 50)); JPanel labelPanel = new JPanel(new GridLayout(2, 1, 0, 5)); labelPanel.add(new JLabel("Name: ")); labelPanel.add(new JLabel("Description: ")); JPanel infoPanel = new JPanel(new GridLayout(2, 1, 0, 5)); infoPanel.add(configurationName);//from w w w . j a va2 s . c o m configurationName.setEditable(false); infoPanel.add(configurationDesc); configurationDesc.setEditable(false); rsTopPanel.add(labelPanel, BorderLayout.WEST); rsTopPanel.add(infoPanel, BorderLayout.CENTER); sidePanel.add(rsTopPanel, BorderLayout.NORTH); configPanel.add(sidePanel, BorderLayout.EAST); return configPanel; }
From source file:io.github.jeremgamer.editor.panels.MusicFrame.java
public MusicFrame(JFrame frame, final GeneralSave gs) { ArrayList<BufferedImage> icons = new ArrayList<BufferedImage>(); try {/*from www . j a v a 2 s . co m*/ icons.add(ImageIO.read(ImageGetter.class.getResource("icon16.png"))); icons.add(ImageIO.read(ImageGetter.class.getResource("icon32.png"))); icons.add(ImageIO.read(ImageGetter.class.getResource("icon64.png"))); icons.add(ImageIO.read(ImageGetter.class.getResource("icon128.png"))); } catch (IOException e1) { e1.printStackTrace(); } this.setIconImages((List<? extends Image>) icons); this.setTitle("Musique"); this.setSize(new Dimension(300, 225)); this.addWindowListener(new WindowListener() { @Override public void windowActivated(WindowEvent event) { } @Override public void windowClosed(WindowEvent event) { } @Override public void windowClosing(WindowEvent event) { try { gs.save(new File("projects/" + Editor.getProjectName() + "/general.rbd")); } catch (IOException e) { e.printStackTrace(); } if (clip != null) { clip.stop(); clip.close(); try { audioStream.close(); } catch (IOException e) { e.printStackTrace(); } } } @Override public void windowDeactivated(WindowEvent event) { } @Override public void windowDeiconified(WindowEvent event) { } @Override public void windowIconified(WindowEvent event) { } @Override public void windowOpened(WindowEvent event) { } }); this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); content.setLayout(new BoxLayout(content, BoxLayout.PAGE_AXIS)); this.setModal(true); this.setLocationRelativeTo(frame); JPanel properties = new JPanel(); properties.setBorder(BorderFactory.createTitledBorder("Lecture")); ButtonGroup bg = new ButtonGroup(); bg.add(one); bg.add(loop); one.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent event) { JRadioButton rb = (JRadioButton) event.getSource(); if (rb.isSelected()) { gs.set("music.reading", 0); try { gs.save(new File("projects/" + Editor.getProjectName() + "/general.rbd")); } catch (IOException e) { e.printStackTrace(); } if (clip != null) { if (clip.isRunning()) clip.loop(0); } } } }); loop.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent event) { JRadioButton rb = (JRadioButton) event.getSource(); if (rb.isSelected()) { gs.set("music.reading", 1); try { gs.save(new File("projects/" + Editor.getProjectName() + "/general.rbd")); } catch (IOException e) { e.printStackTrace(); } if (clip != null) { if (clip.isRunning()) clip.loop(Clip.LOOP_CONTINUOUSLY); } } } }); properties.add(one); properties.add(loop); if (gs.getInt("music.reading") == 0) { one.setSelected(true); } else { loop.setSelected(true); } volume.setMaximum(100); volume.setMinimum(0); volume.setValue(30); volume.setPaintTicks(true); volume.setPaintLabels(true); volume.setMinorTickSpacing(10); volume.setMajorTickSpacing(20); volume.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent event) { JSlider slider = (JSlider) event.getSource(); double value = slider.getValue(); gain = value / 100; dB = (float) (Math.log(gain) / Math.log(10.0) * 20.0); if (clip != null) gainControl.setValue(dB); gs.set("music.volume", (int) value); } }); volume.setValue(gs.getInt("music.volume")); properties.add(volume); properties.setPreferredSize(new Dimension(300, 125)); content.add(properties); JPanel browsePanel = new JPanel(); browsePanel.setBorder(BorderFactory.createTitledBorder("")); JButton browse = new JButton("Parcourir..."); if (new File("projects/" + Editor.getProjectName() + "/music.wav").exists()) { preview.setEnabled(false); browse.setText(""); try { browse.setIcon(new ImageIcon(ImageIO.read(ImageGetter.class.getResource("remove.png")))); } catch (IOException e) { e.printStackTrace(); } } browse.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { JButton button = (JButton) event.getSource(); if (new File("projects/" + Editor.getProjectName() + "/music.wav").exists()) { if (clip != null) { clip.stop(); clip.close(); try { audioStream.close(); } catch (IOException e) { e.printStackTrace(); } } name.setText(""); preview.setEnabled(false); button.setText("Parcourir..."); button.setIcon(null); new File("projects/" + Editor.getProjectName() + "/music.wav").delete(); gs.set("music.name", ""); } else { String path = null; JFileChooser chooser = new JFileChooser(Editor.lastPath); FileNameExtensionFilter filter = new FileNameExtensionFilter("Audio (WAV)", "wav"); chooser.setFileFilter(filter); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); int option = chooser.showOpenDialog(null); if (option == JFileChooser.APPROVE_OPTION) { path = chooser.getSelectedFile().getAbsolutePath(); Editor.lastPath = chooser.getSelectedFile().getParent(); copyMusic(new File(path)); button.setText(""); try { button.setIcon( new ImageIcon(ImageIO.read(ImageGetter.class.getResource("remove.png")))); } catch (IOException e) { e.printStackTrace(); } gs.set("music.name", new File(path).getName()); try { gs.save(new File("projects/" + Editor.getProjectName() + "/general.rbd")); } catch (IOException e) { e.printStackTrace(); } name.setText(new File(path).getName()); preview.setEnabled(true); } } } }); if (new File("projects/" + Editor.getProjectName() + "/music.wav").exists()) { preview.setEnabled(true); } else { preview.setEnabled(false); } preview.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { JToggleButton tb = (JToggleButton) event.getSource(); if (tb.isSelected()) { try { audioStream = AudioSystem.getAudioInputStream( new File("projects/" + Editor.getProjectName() + "/music.wav")); format = audioStream.getFormat(); info = new DataLine.Info(Clip.class, format); clip = (Clip) AudioSystem.getLine(info); clip.open(audioStream); clip.start(); gainControl = (FloatControl) clip.getControl(FloatControl.Type.MASTER_GAIN); gainControl.setValue(dB); if (loop.isSelected()) { clip.loop(Clip.LOOP_CONTINUOUSLY); } else { clip.loop(0); } clip.addLineListener(new LineListener() { @Override public void update(LineEvent event) { Clip clip = (Clip) event.getSource(); if (!clip.isRunning()) { preview.setSelected(false); clip.stop(); clip.close(); try { audioStream.close(); } catch (IOException e) { e.printStackTrace(); } } } }); } catch (Exception exc) { exc.printStackTrace(); } } else { clip.stop(); clip.close(); try { audioStream.close(); } catch (IOException e) { e.printStackTrace(); } } } }); JPanel buttons = new JPanel(); buttons.setLayout(new BorderLayout()); buttons.add(browse, BorderLayout.WEST); buttons.add(preview, BorderLayout.EAST); browsePanel.setLayout(new BorderLayout()); browsePanel.add(buttons, BorderLayout.NORTH); browsePanel.add(name, BorderLayout.SOUTH); name.setPreferredSize(new Dimension(280, 25)); name.setText(gs.getString("music.name")); content.add(browsePanel); this.setContentPane(content); this.setVisible(true); }
From source file:edu.ucla.stat.SOCR.chart.SuperPowerChart.java
/** * make the show_all panel//from w w w. ja va 2 s . co m */ protected void setMixPanel() { /*super.setMixPanel(); return;*/ dataPanel2.removeAll(); graphPanel2.removeAll(); chartPanel.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, CHART_SIZE_Y * 2 / 3)); graphPanel2.add(chartPanel); // sliderPanel.removeAll(); /* sliderPanel.add(new JLabel("Bin Size")); sliderPanel.add(this.binSlider); sliderPanel.add(new JLabel(":"+this.binSlider.getValue()));*/ /* powerSlider.setPreferredSize(new Dimension(CHART_SIZE_X*2/3,100)); sliderPanel.add(this.powerSlider); sliderPanel.setPreferredSize(new Dimension(CHART_SIZE_X*2/3,100));*/ // graphPanel2.add(sliderPanel); // the slider graphPanel2.validate(); dataPanel2.add(new JLabel(" ")); dataPanel2.add(new JLabel("Data")); JScrollPane dt = new JScrollPane(dataTable); dt.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y * 3 / 8)); dataPanel2.add(dt); JScrollPane st = new JScrollPane(summaryPanel); st.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y / 6)); dataPanel2.add(st); st.validate(); dataPanel2.add(new JLabel(" ")); dataPanel2.add(new JLabel("Mapping")); mapPanel.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y / 2)); dataPanel2.add(mapPanel); dataPanel2.validate(); mixPanel.removeAll(); mixPanel.add(graphPanel2, BorderLayout.WEST); mixPanel.add(new JScrollPane(dataPanel2), BorderLayout.CENTER); mixPanel.validate(); }
From source file:src.gui.LifelinePanel.java
public void buildBottonToolBar() { buttonPanel = new JPanel(new BorderLayout()); buttonPanel.setBackground(Color.WHITE); //JLabel test = new JLabel("<html><a href=\"http://www.google.com\">delete</a></html>"); JPanel leftpanel = new JPanel(new BorderLayout()); leftpanel.setBackground(Color.WHITE); JButton button = new JButton(editLifeLine); button.setToolTipText("Edit lifeline"); button.setBackground(Color.WHITE); button.setBorderPainted(false);// ww w . j a v a 2 s. c om leftpanel.add(button, BorderLayout.WEST); button.setRolloverEnabled(true); button = new JButton(deleteLifeLine); button.setToolTipText("Delete lifeline"); button.setBackground(Color.WHITE); button.setBorderPainted(false); leftpanel.add(button, BorderLayout.EAST); button.setRolloverEnabled(true); //JLabel editlabel = new JLabel("<html><b><u>edit</u></b> </html>"); //leftpanel.add(editlabel, BorderLayout.WEST); //JLabel deletelabel = new JLabel("<html><b><u>delete</u></b></html>"); //leftpanel.add(deletelabel, BorderLayout.EAST); buttonPanel.add(leftpanel, BorderLayout.EAST); this.add(buttonPanel, BorderLayout.SOUTH); }
From source file:org.zaproxy.zap.extension.callgraph.CallGraphFrame.java
private void setupFrame() { // define a visual layout on the graph mxHierarchicalLayout layout = new com.mxgraph.layout.hierarchical.mxHierarchicalLayout(graph, SwingConstants.WEST); final mxGraphComponent graphComponent = new mxGraphComponent(graph); graphComponent.setConnectable(false); graphComponent.setToolTips(true);// w w w .j a v a 2s . com graphComponent.setAutoExtend(true); graphComponent.setAutoScroll(true); // add the graph component to the frame in the centre. getContentPane().add(graphComponent, BorderLayout.CENTER); // and set up a panel below that JPanel toolBar = new JPanel(); toolBar.setLayout(new BorderLayout()); // with an outline of the graph, and have it settle in the west.. final mxGraphOutline graphOutline = new mxGraphOutline(graphComponent); graphOutline.setPreferredSize(new Dimension(100, 100)); toolBar.add(graphOutline, BorderLayout.WEST); // and some buttons in the panel JPanel buttonBar = new JPanel(); buttonBar.setLayout(new FlowLayout()); // zoom to fit button JButton btZoomToFit = new JButton(Constant.messages.getString("callgraph.button.zoomfit")); btZoomToFit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { double newScale = 1; Dimension graphSize = graphComponent.getGraphControl().getSize(); Dimension viewPortSize = graphComponent.getViewport().getSize(); int gw = (int) graphSize.getWidth(); int gh = (int) graphSize.getHeight(); if (gw > 0 && gh > 0) { int w = (int) viewPortSize.getWidth(); int h = (int) viewPortSize.getHeight(); newScale = Math.min((double) w / gw, (double) h / gh); } graphComponent.zoomTo(newScale, true); } }); buttonBar.add(btZoomToFit); // center graph JButton btCenter = new JButton(Constant.messages.getString("callgraph.button.centregraph")); btCenter.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { Dimension graphSize = graphComponent.getGraphControl().getSize(); Dimension viewPortSize = graphComponent.getViewport().getSize(); int x = graphSize.width / 2 - viewPortSize.width / 2; int y = graphSize.height / 2 - viewPortSize.height / 2; int w = viewPortSize.width; int h = viewPortSize.height; graphComponent.getGraphControl().scrollRectToVisible(new Rectangle(x, y, w, h)); } }); buttonBar.add(btCenter); // add a rubberband zoom on the mouse selection event new mxRubberband(graphComponent) { public void mouseReleased(MouseEvent e) { // get bounds before they are reset Rectangle rect = bounds; // invoke usual behaviour super.mouseReleased(e); if (rect != null) { double newScale = 1; Dimension graphSize = new Dimension(rect.width, rect.height); Dimension viewPortSize = graphComponent.getViewport().getSize(); int gw = (int) graphSize.getWidth(); int gh = (int) graphSize.getHeight(); if (gw > 0 && gh > 0) { int w = (int) viewPortSize.getWidth(); int h = (int) viewPortSize.getHeight(); newScale = Math.min((double) w / gw, (double) h / gh); } // zoom to fit the selected area on screen graphComponent.zoom(newScale); // make the selected area visible graphComponent.getGraphControl() .scrollRectToVisible(new Rectangle((int) (rect.x * newScale), (int) (rect.y * newScale), (int) (rect.width * newScale), (int) (rect.height * newScale))); } } }; // put the components on frame toolBar.add(buttonBar, BorderLayout.CENTER); getContentPane().add(toolBar, BorderLayout.SOUTH); // TODO: Do we need this here? // frame.setVisible(true); // lay it out graph.getModel().beginUpdate(); try { layout.execute(graph.getDefaultParent()); } finally { graph.getModel().endUpdate(); } // setDefaultCloseOperation(JFrame.); // setSize(400, 400); pack(); setVisible(true); }
From source file:org.apache.jmeter.protocol.http.gui.HTTPFileArgsPanel.java
/** * Initialize the components and layout of this component. *//*from w w w . j a va 2 s .c o m*/ private void init() { // WARNING: called from ctor so must not be overridden (i.e. must be private or final) JPanel p = this; p.setLayout(new BorderLayout()); // retro compatibility, will be removed in the next version if (tableLabel != null) { p.add(makeLabelPanel(), BorderLayout.NORTH); } p.add(makeMainPanel(), BorderLayout.CENTER); // Force a minimum table height of 70 pixels p.add(Box.createVerticalStrut(70), BorderLayout.WEST); p.add(makeButtonPanel(), BorderLayout.SOUTH); table.revalidate(); sizeColumns(table); }
From source file:gda.gui.BatonPanel.java
private void initGUI() { try {/*from w ww . j a va2 s . c om*/ { BorderLayout thisLayout = new BorderLayout(); this.setLayout(thisLayout); this.setPreferredSize(new java.awt.Dimension(902, 431)); } { JPanel jPanel1 = new JPanel(); this.add(jPanel1, BorderLayout.WEST); this.add(getPnlMessages(), BorderLayout.CENTER); jPanel1.setLayout(null); jPanel1.setPreferredSize(new java.awt.Dimension(480, 419)); { sudoPanel = new JPanel(); BorderLayout sudoPanelLayout = new BorderLayout(); sudoPanel.setLayout(sudoPanelLayout); jPanel1.add(sudoPanel); sudoPanel.add(getPnlSudoButtons(), BorderLayout.CENTER); sudoPanel.add(getPnlSUMessage(), BorderLayout.NORTH); sudoPanel.setBorder(BorderFactory.createTitledBorder("Switch User")); sudoPanel.setBounds(12, 340, 456, 80); } { otherClientPanel = new JPanel(); jPanel1.add(otherClientPanel); otherClientPanel.setBorder(BorderFactory.createTitledBorder("Clients on this beamline")); otherClientPanel.setBounds(12, 15, 456, 215); otherClientPanel.setLayout(null); { lblUser = new JLabel(); otherClientPanel.add(lblUser); lblUser.setText("You are logged in as: abc123"); lblUser.setBounds(15, 36, 422, 14); lblUser.setHorizontalAlignment(SwingConstants.CENTER); lblUser.setHorizontalTextPosition(SwingConstants.CENTER); } { lblBaton = new JLabel(); otherClientPanel.add(lblBaton); lblBaton.setText("You hold the baton and have control of the beamline"); lblBaton.setBounds(15, 66, 422, 14); lblBaton.setHorizontalTextPosition(SwingConstants.CENTER); lblBaton.setInheritsPopupMenu(false); lblBaton.setHorizontalAlignment(SwingConstants.CENTER); } { JScrollPane jScrollPane1 = new JScrollPane(); otherClientPanel.add(jScrollPane1); jScrollPane1.setBounds(73, 96, 306, 97); { userClients = new JTable(); jScrollPane1.setViewportView(userClients); userClients.setModel(this.new BatonTableModel()); userClients.setAutoCreateRowSorter(true); userClients.setPreferredSize(new java.awt.Dimension(213, 97)); userClients.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); userClients.setColumnSelectionAllowed(false); userClients.getSelectionModel().addListSelectionListener(this); DefaultTableCellRenderer renderer = new DefaultTableCellRenderer(); renderer.setHorizontalAlignment(SwingConstants.CENTER); userClients.getColumnModel().getColumn(0).setCellRenderer(renderer); userClients.getColumnModel().getColumn(1).setCellRenderer(renderer); userClients.getColumnModel().getColumn(2).setCellRenderer(renderer); JTableHeader th = userClients.getTableHeader(); th.addMouseListener(this); } } } { buttonsPanel = new JPanel(); BorderLayout buttonsPanelLayout = new BorderLayout(); buttonsPanel.setLayout(buttonsPanelLayout); jPanel1.add(buttonsPanel); buttonsPanel.setBorder(BorderFactory.createTitledBorder("Baton control")); buttonsPanel.setBounds(12, 242, 456, 92); buttonsPanel.add(getPnlControlButton(), BorderLayout.CENTER); buttonsPanel.add(getPnlTickBox(), BorderLayout.SOUTH); } } } catch (Exception e) { logger.error(e.getMessage(), e); } }
From source file:com.joey.software.regionSelectionToolkit.controlers.ImageProfileTool.java
public JPanel getControls() { if (controls == null) { controls = new JPanel(new BorderLayout()); JPanel dirButton = new JPanel(new GridLayout(1, 2)); dirButton.add(moveUpData);/* ww w .jav a 2 s . c om*/ dirButton.add(moveDownData); JPanel buttonPanel = new JPanel(new GridLayout(1, 3)); buttonPanel.add(showFlattenedButton); buttonPanel.add(showAScanButton); buttonPanel.add(estimageSurface); JPanel pointsPanel = new JPanel(new BorderLayout()); pointsPanel.add(saveData, BorderLayout.SOUTH); pointsPanel.add(axisToggle, BorderLayout.WEST); pointsPanel.add(numPoints, BorderLayout.CENTER); pointsPanel.add(updatePoints, BorderLayout.EAST); pointsPanel.add(buttonPanel, BorderLayout.NORTH); JPanel offsetPane = new JPanel(new BorderLayout()); offsetPane.add(showOffset, BorderLayout.WEST); offsetPane.add(offset, BorderLayout.CENTER); JPanel temp = new JPanel(new BorderLayout()); temp.add(offsetPane, BorderLayout.SOUTH); temp.add(transparance, BorderLayout.NORTH); JPanel toolPanel = new JPanel(new BorderLayout()); toolPanel.add(temp, BorderLayout.NORTH); toolPanel.add(pointsPanel, BorderLayout.CENTER); toolPanel.add(dirButton, BorderLayout.SOUTH); controls.add(toolPanel, BorderLayout.NORTH); estimageSurface.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { estimateSurface(); } }); showAScanButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { showAScanPanel(); } }); axisToggle.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (axis == AXIS_X) { setAxis(AXIS_Y); axisToggle.setText("Y Axis"); } else { setAxis(AXIS_X); axisToggle.setText("X Axis"); } panel.repaint(); } }); transparance.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { panel.repaint(); } }); showOffset.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { panel.repaint(); } }); offset.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { panel.shapeChanged(); panel.repaint(); updatePlotPanel(); } }); showFlattenedButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { showFlattenedImage(); } }); updatePoints.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setDataPoints((Integer) numPoints.getValue()); } }); moveUPTimer = new Timer(delay, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { addValue(1.0f / view.getImage().getHeight()); } }); moveDownTimer = new Timer(delay, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { addValue(-1.0f / view.getImage().getHeight()); } }); moveUpData.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { JButton btn2 = (JButton) e.getSource(); ButtonModel model = btn2.getModel(); if (model.isPressed() && !moveUPTimer.isRunning()) { moveUPTimer.start(); } else if (!model.isPressed() && moveUPTimer.isRunning()) { moveUPTimer.stop(); } } }); moveDownData.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { JButton btn2 = (JButton) e.getSource(); ButtonModel model = btn2.getModel(); if (model.isPressed() && !moveDownTimer.isRunning()) { moveDownTimer.start(); } else if (!model.isPressed() && moveDownTimer.isRunning()) { moveDownTimer.stop(); } } }); moveUpData.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { addValue(1.0f / view.getImage().getHeight()); } }); moveDownData.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { addValue(-1.0f / view.getImage().getHeight()); } }); saveData.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { saveData(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }); } return controls; }
From source file:org.paxle.desktop.impl.dialogues.cconsole.CrawlingConsole.java
private void init(final MWComponents comp, final boolean showEnqueued, final boolean showDestroyed) { scroll.setViewportView(table);//from ww w. j a va 2s .co m updateCpb(false, true, false); cbEnq.setSelected(showEnqueued); cbDstr.setSelected(showDestroyed); cbox.setActionCommand(AC_SELECT); cbox.setSelectedIndex(comp.ordinal()); final JPanel bbLeft = new JPanel(new FlowLayout(FlowLayout.LEFT)); bbLeft.add(cpb); bbLeft.add(cbox); bbLeft.add(cbEnq); bbLeft.add(cbDstr); final JPanel bbRight = new JPanel(new FlowLayout(FlowLayout.RIGHT)); clear.setEnabled(false); bbRight.add(Utilities.instance.setButtonProps(new JToggleButton(), "\u2193 " + Messages.getString("crawlingConsole.settings"), this, AC_SETTINGS, KeyEvent.VK_S, null)); bbRight.add(clear); final JPanel b = new JPanel(new BorderLayout()); b.add(bbLeft, BorderLayout.WEST); b.add(bbRight, BorderLayout.EAST); options.setVisible(false); b.add(options, BorderLayout.SOUTH); super.setLayout(new BorderLayout()); super.add(scroll, BorderLayout.CENTER); super.add(b, BorderLayout.SOUTH); }