List of usage examples for javax.swing BoxLayout PAGE_AXIS
int PAGE_AXIS
To view the source code for javax.swing BoxLayout PAGE_AXIS.
Click Source Link
From source file:com.db4o.sync4o.ui.Db4oSyncSourceConfigPanel.java
private void setupControls() { // Layout and setup UI components... setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); add(_namePanel);//from w ww.j a v a2 s . c o m _namePanel.setAlignmentX(Component.LEFT_ALIGNMENT); add(_fieldsPanel); _fieldsPanel.setAlignmentX(Component.LEFT_ALIGNMENT); add(_classConfigsTree); _classConfigsTree.setAlignmentX(Component.LEFT_ALIGNMENT); _classConfigsTree.setPreferredSize(new Dimension(300, 300)); add(_buttonsPanel); _buttonsPanel.setAlignmentX(Component.LEFT_ALIGNMENT); JLabel l; // Admin UI Management Panels use a title // (in a particular "title font") to identify themselves l = new JLabel("Edit Db4oSyncSource Configuration", SwingConstants.CENTER); l.setBorder(new TitledBorder("")); l.setFont(titlePanelFont); _namePanel.add(l); GridBagConstraints labelConstraints = new GridBagConstraints(); labelConstraints.gridwidth = 1; labelConstraints.fill = GridBagConstraints.NONE; labelConstraints.weightx = 0.0; labelConstraints.gridx = 0; labelConstraints.gridy = 0; labelConstraints.anchor = GridBagConstraints.EAST; GridBagConstraints fieldConstraints = new GridBagConstraints(); fieldConstraints.gridwidth = 2; fieldConstraints.fill = GridBagConstraints.HORIZONTAL; fieldConstraints.weightx = 1.0; fieldConstraints.gridx = 1; fieldConstraints.gridy = 0; _fieldsPanel.add(new JLabel("Source URI: "), labelConstraints); _fieldsPanel.add(_sourceUriValue, fieldConstraints); labelConstraints.gridy = GridBagConstraints.RELATIVE; fieldConstraints.gridy = GridBagConstraints.RELATIVE; _fieldsPanel.add(new JLabel("Name: "), labelConstraints); _fieldsPanel.add(_nameValue, fieldConstraints); fieldConstraints.gridwidth = 1; _fieldsPanel.add(new JLabel("db4o File: "), labelConstraints); _fieldsPanel.add(_dbFileValue, fieldConstraints); _dbFileValue.setEditable(false); fieldConstraints.gridwidth = 2; GridBagConstraints buttonConstraints = new GridBagConstraints(); buttonConstraints.gridwidth = 1; buttonConstraints.fill = GridBagConstraints.NONE; buttonConstraints.gridx = 2; buttonConstraints.gridy = 3; _dbFileLocateButton.setText("..."); _fieldsPanel.add(_dbFileLocateButton, buttonConstraints); buttonConstraints.gridwidth = 3; buttonConstraints.fill = GridBagConstraints.NONE; buttonConstraints.gridx = 0; buttonConstraints.gridy = GridBagConstraints.RELATIVE; buttonConstraints.anchor = GridBagConstraints.CENTER; // Ensure all the controls use the Admin UI standard font Component[] components = _fieldsPanel.getComponents(); for (int i = 0; i < components.length; i++) { Component c = components[i]; c.setFont(defaultFont); } _confirmButton.setText("Add"); _buttonsPanel.add(_confirmButton); }
From source file:org.omelogic.tome.EpiTome.java
public void init() { backingGraph = null;//from w ww . j a va 2 s . co m tomeGraph = null; idFilter = null; JPanel tablePanel = new JPanel(); tomeTable = new JTable(); JScrollPane tomeTableScroller = new JScrollPane(tomeTable); tablePanel.setLayout(new BoxLayout(tablePanel, BoxLayout.PAGE_AXIS)); tablePanel.add(tomeTableScroller); tomeProps = new JLabel(""); JPanel tomePropsPanel = new JPanel(new BorderLayout()); tomePropsPanel.add(tomeProps, BorderLayout.LINE_START); //tablePanel.add(tomeTableFixed); tablePanel.add(tomePropsPanel); //JScrollPane tablePanelScroller = new JScrollPane(tablePanel); tablePanel.setPreferredSize(new Dimension(300, 400)); //####### CONTROLS ######################################### JPanel controlPanel = new JPanel(); JButton load = new JButton("LOAD"); load.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent act) { JFileChooser chooser = new JFileChooser(); chooser.setFileFilter(new SIFFileFilter()); chooser.setMultiSelectionEnabled(false); int returnVal = chooser.showOpenDialog(tomeFrame); if (returnVal == JFileChooser.APPROVE_OPTION) { System.out.println("You chose to open this file: " + chooser.getSelectedFile().getName()); } else { return; } File sifFile = chooser.getSelectedFile(); UndirectedSparseGraph result = null; try { result = SIFHandler.load(sifFile); } catch (Exception e) { System.out.println(e.toString()); } System.out.println("Loaded file!"); backingGraph = result; FilterDialog filterMe = new FilterDialog(); idFilter = filterMe.getFilter(); loadInitialGraph((UndirectedSparseGraph) TomeGraphUtilities.filterGraph(backingGraph, idFilter)); } }); JButton save = new JButton("SAVE"); save.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent act) { if (tomeGraph == null) { JOptionPane.showMessageDialog(null, "No graph is loaded!", "ERROR!", JOptionPane.ERROR_MESSAGE); return; } JFileChooser chooser = new JFileChooser(); if (((Double) ((HashMap<String, Double>) (tomeGraph.getUserDatum("GraphStatistics"))) .get("AveragePathLength")).isInfinite()) { JOptionPane.showMessageDialog(null, "Graph is not fully connected! This renders most output useless. Try trimming the graph first...", "ERROR!", JOptionPane.ERROR_MESSAGE); return; } int returnVal = chooser.showSaveDialog(EpiTome.this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); FileOutputStream out; // declare a file output object PrintStream p; // declare a print stream object try { // Create a new file output stream out = new FileOutputStream(file); // Connect print stream to the output stream p = new PrintStream(out); HashMap<String, Double> graphProps = (HashMap<String, Double>) tomeGraph .getUserDatum("GraphStatistics"); p.println("#---SUMMARY---"); p.println("#NumNodes:\t" + tomeGraph.numVertices()); p.println("#NumEdges:\t" + tomeGraph.numEdges()); p.println("#ClustCoeff:\t" + graphProps.get(TomeGraphUtilities.CLUSTERING_COEFFICIENT)); p.println("#AvgPathLen:\t" + graphProps.get(TomeGraphUtilities.AVERAGE_PATH_LENGTH)); p.println("#AvgDegree:\t" + graphProps.get(TomeGraphUtilities.AVERAGE_DEGREE)); p.println("#-------------"); p.println("\n\n"); p.println("NodeID\tClustCoeff\tAvgPathLen\tAvgDegree"); Iterator<TomeVertex> vertIter = tomeGraph.getVertices().iterator(); while (vertIter.hasNext()) { TomeVertex vert = vertIter.next(); p.println(vert.getID() + "\t" + vert.getClusteringCoefficient() + "\t" + vert.getAverageDistance() + "\t" + vert.getDegree()); } p.close(); } catch (Exception e) { JOptionPane.showMessageDialog(null, "Error writing to file!\n" + e.toString(), "ERROR!", JOptionPane.ERROR_MESSAGE); } } } }); JButton trim = new JButton("TRIM"); trim.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (tomeGraph == null) { JOptionPane.showMessageDialog(null, "No graph is loaded!", "ERROR!", JOptionPane.ERROR_MESSAGE); return; } TrimDialog trimMe = new TrimDialog(); loadSubGraph(trimMe.getTrimmedGraph(tomeGraph)); } }); JButton rset = new JButton("RSET"); rset.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (backingGraph == null) { JOptionPane.showMessageDialog(null, "No graph is loaded!", "ERROR!", JOptionPane.ERROR_MESSAGE); return; } loadInitialGraph((UndirectedSparseGraph) TomeGraphUtilities.filterGraph(backingGraph, idFilter)); } }); JButton view = new JButton("VIEW"); view.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (tomeGraph == null) { JOptionPane.showMessageDialog(null, "No graph is loaded!", "ERROR!", JOptionPane.ERROR_MESSAGE); return; } GraphDialog graf = new GraphDialog(tomeGraph, getSelectedNodeSubGraph()); } }); JButton ctrl = new JButton("CTRL"); ctrl.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (tomeGraph == null) { JOptionPane.showMessageDialog(null, "No graph is loaded!", "ERROR!", JOptionPane.ERROR_MESSAGE); return; } try { ControlsDialog ctrls = new ControlsDialog(tomeGraph, backingGraph, NUM_CONTROLS, NUM_BINS_MAX); } catch (Exception excep) { } } }); JButton help = new JButton("HELP"); help.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { HelpDialog.display(); } }); controlPanel.add(load); controlPanel.add(save); controlPanel.add(trim); controlPanel.add(rset); controlPanel.add(view); controlPanel.add(ctrl); controlPanel.add(help); //########################################################## Container content = tomeFrame.getContentPane(); content.removeAll(); content.add(tablePanel, BorderLayout.CENTER); content.add(controlPanel, BorderLayout.SOUTH); }
From source file:e3fraud.gui.MainWindow.java
public MainWindow() { super(new BorderLayout(5, 5)); extended = false;/*from ww w . j a va 2 s . co m*/ //Create the log first, because the action listeners //need to refer to it. log = new JTextArea(10, 50); log.setMargin(new Insets(5, 5, 5, 5)); log.setEditable(false); logScrollPane = new JScrollPane(log); DefaultCaret caret = (DefaultCaret) log.getCaret(); caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE); // create the progress bar progressBar = new JProgressBar(0, 100); progressBar.setValue(progressBar.getMinimum()); progressBar.setVisible(false); progressBar.setStringPainted(true); //Create the settings pane generationSettingLabel = new JLabel("Generate:"); SpinnerModel collusionsSpinnerModel = new SpinnerNumberModel(1, 0, 3, 1); collusionSettingsPanel = new JPanel(new FlowLayout()) { @Override public Dimension getMaximumSize() { return getPreferredSize(); } }; // collusionSettingsPanel.setLayout(new BoxLayout(collusionSettingsPanel, BoxLayout.X_AXIS)); collusionsButton = new JSpinner(collusionsSpinnerModel); collusionsLabel = new JLabel("collusion(s)"); collusionSettingsPanel.add(collusionsButton); collusionSettingsPanel.add(collusionsLabel); rankingSettingLabel = new JLabel("Rank by:"); lossButton = new JRadioButton("loss"); lossButton.setToolTipText("Sort sub-ideal models based on loss for Target of Assessment (high -> low)"); gainButton = new JRadioButton("gain"); gainButton.setToolTipText( "Sort sub-ideal models based on gain of any actor except Target of Assessment (high -> low)"); lossGainButton = new JRadioButton("loss + gain"); lossGainButton.setToolTipText( "Sort sub-ideal models based on loss for Target of Assessment and, if equal, on gain of any actor except Target of Assessment"); //gainLossButton = new JRadioButton("gain + loss"); lossGainButton.setSelected(true); rankingGroup = new ButtonGroup(); rankingGroup.add(lossButton); rankingGroup.add(gainButton); rankingGroup.add(lossGainButton); //rankingGroup.add(gainLossButton); groupingSettingLabel = new JLabel("Group by:"); groupingButton = new JCheckBox("collusion"); groupingButton.setToolTipText( "Groups sub-ideal models based on the pair of actors colluding before ranking them"); groupingButton.setSelected(false); refreshButton = new JButton("Refresh"); refreshButton.addActionListener(this); settingsPanel = new JPanel(); settingsPanel.setLayout(new BoxLayout(settingsPanel, BoxLayout.PAGE_AXIS)); settingsPanel.add(Box.createRigidArea(new Dimension(0, 5))); settingsPanel.add(generationSettingLabel); collusionSettingsPanel.setAlignmentX(LEFT_ALIGNMENT); settingsPanel.add(Box.createRigidArea(new Dimension(0, 5))); settingsPanel.add(collusionSettingsPanel); settingsPanel.add(Box.createRigidArea(new Dimension(0, 5))); rankingSettingLabel.setAlignmentY(TOP_ALIGNMENT); settingsPanel.add(rankingSettingLabel); settingsPanel.add(lossButton); settingsPanel.add(gainButton); settingsPanel.add(lossGainButton); //settingsPanel.add(gainLossButton); settingsPanel.add(Box.createRigidArea(new Dimension(0, 5))); settingsPanel.add(groupingSettingLabel); settingsPanel.add(groupingButton); settingsPanel.add(Box.createRigidArea(new Dimension(0, 5))); settingsPanel.add(refreshButton); settingsPanel.add(Box.createRigidArea(new Dimension(0, 20))); progressBar.setPreferredSize( new Dimension(settingsPanel.getSize().width, progressBar.getPreferredSize().height)); settingsPanel.add(progressBar); //Create the result tree root = new DefaultMutableTreeNode("No models to display"); treeModel = new DefaultTreeModel(root); tree = new JTree(treeModel); //tree.setUI(new CustomTreeUI()); tree.setCellRenderer(new CustomTreeCellRenderer(tree)); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); tree.setLargeModel(true); resultScrollPane = new JScrollPane(tree); tree.addTreeSelectionListener(treeSelectionListener); //tree.setShowsRootHandles(true); //Create a file chooser for saving sfc = new JFileChooser(); FileFilter jpegFilter = new FileNameExtensionFilter("JPEG image", new String[] { "jpg", "jpeg" }); sfc.addChoosableFileFilter(jpegFilter); sfc.setFileFilter(jpegFilter); //Create a file chooser for loading fc = new JFileChooser(); FileFilter rdfFilter = new FileNameExtensionFilter("RDF file", "RDF"); fc.addChoosableFileFilter(rdfFilter); fc.setFileFilter(rdfFilter); //Create the open button. openButton = new JButton("Load model", createImageIcon("images/Open24.png")); openButton.addActionListener(this); openButton.setToolTipText("Load a e3value model"); //Create the ideal graph button. idealGraphButton = new JButton("Show ideal graph", createImageIcon("images/Plot.png")); idealGraphButton.setToolTipText("Display ideal profitability graph"); idealGraphButton.addActionListener(this); Dimension thinButtonDimension = new Dimension(15, 420); //Create the expand subideal graph button. expandButton = new JButton(">"); expandButton.setPreferredSize(thinButtonDimension); expandButton.setMargin(new Insets(0, 0, 0, 0)); expandButton.setToolTipText("Expand to show non-ideal profitability graph for selected model"); expandButton.addActionListener(this); //Create the collapse sub-ideal graph button. collapseButton = new JButton("<"); collapseButton.setPreferredSize(thinButtonDimension); collapseButton.setMargin(new Insets(0, 0, 0, 0)); collapseButton.setToolTipText("Collapse non-ideal profitability graph for selected model"); collapseButton.addActionListener(this); //Create the generation button. generateButton = new JButton("Generate sub-ideal models", createImageIcon("images/generate.png")); generateButton.addActionListener(this); generateButton.setToolTipText("Generate sub-ideal models for the e3value model currently loaded"); //Create the chart panel chartPane = new JPanel(); chartPane.setLayout(new FlowLayout(FlowLayout.LEFT)); chartPane.add(expandButton); //For layout purposes, put the buttons in a separate panel JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); buttonPanel.add(openButton); buttonPanel.add(Box.createRigidArea(new Dimension(20, 0))); buttonPanel.add(generateButton); buttonPanel.add(Box.createRigidArea(new Dimension(10, 0))); buttonPanel.add(idealGraphButton); //Add the buttons, the ranking options, the result list and the log to this panel. add(buttonPanel, BorderLayout.PAGE_START); add(settingsPanel, BorderLayout.LINE_START); add(resultScrollPane, BorderLayout.CENTER); add(logScrollPane, BorderLayout.PAGE_END); add(chartPane, BorderLayout.LINE_END); //and make a nice border around it setBorder(BorderFactory.createEmptyBorder(5, 10, 10, 10)); }
From source file:com.raceup.fsae.test.TesterGui.java
/** * Shows gui to start a test//from www . j a va2 s .c o m */ private void openQuestionsPanel() { currentSubmissionTimer = new ClockTimer("Current submission time"); // start timer currentSubmissionTimer.start(); totalTestTimer.start(); shuffleQuestions(); testPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10) // title border ); JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS)); panel.add(Box.createVerticalStrut(20)); panel.add(new JScrollPane(testPanel)); panel.add(createTimersPanel()); panel.add(createMonitorPanel()); setContentPane(panel); // scroll pane with questions setPreferredSize(new Dimension(400, 600)); pack(); repaint(); setLocationRelativeTo(null); }
From source file:us.ihmc.codecs.loader.OpenH264Downloader.java
/** * Shows an about dialog for the license with disable button, as per license terms *//*from w w w . j ava 2s. com*/ public static void showAboutCiscoDialog() { JPanel panel = new JPanel(); panel.add(new JLabel("OpenH264 Video Codec provided by Cisco Systems, Inc.")); panel.add(new JLabel("License terms")); panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS)); JTextArea license = new JTextArea(getLicenseText()); license.setEditable(false); license.setLineWrap(true); license.setWrapStyleWord(true); JScrollPane scroll = new JScrollPane(license); scroll.setPreferredSize(new Dimension(500, 500)); panel.add(scroll); String[] options = new String[2]; boolean enabled = isEnabled(); if (enabled) { options[0] = "Disable Cisco OpenH264 plugin"; } else { options[0] = "Enable Cisco OpenH264 plugin"; } options[1] = "Close"; int res = JOptionPane.showOptionDialog(null, panel, "OpenH264 Video Codec provided by Cisco Systems, Inc.", JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, null); if (res == 0) { if (enabled) { deleteOpenH264Library(); } else { loadOpenH264(false); } } }
From source file:io.github.jeremgamer.editor.panels.GeneralSettings.java
public GeneralSettings() { this.setBorder(BorderFactory.createTitledBorder("")); JPanel namePanel = new JPanel(); JLabel nameLabel = new JLabel("Nom :"); namePanel.add(nameLabel);//from w ww . j a va 2 s .co m name.setPreferredSize(new Dimension(220, 30)); namePanel.add(name); CaretListener caretUpdateName = new CaretListener() { public void caretUpdate(javax.swing.event.CaretEvent e) { JTextField text = (JTextField) e.getSource(); gs.set("name", text.getText()); } }; name.addCaretListener(caretUpdateName); this.add(namePanel); adress.setEditable(false); CaretListener caretUpdateAdress = new CaretListener() { public void caretUpdate(javax.swing.event.CaretEvent e) { JTextField text = (JTextField) e.getSource(); gs.set("adress", text.getText()); } }; adress.addCaretListener(caretUpdateAdress); JPanel subTypePanel = new JPanel(); JLabel typeLabel = new JLabel("Type :"); subTypePanel.add(typeLabel); type.setPreferredSize(new Dimension(220, 30)); type.addItem("Minecraft classique"); type.addItem("Minecraft personnalis"); if (new File("projects/" + Editor.getProjectName() + "/data.zip").exists()) { type.setSelectedIndex(1); browse.setEnabled(true); browse.setText("Supprimer l'import"); } else { browse.setEnabled(false); } type.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { @SuppressWarnings("unchecked") JComboBox<String> combo = (JComboBox<String>) event.getSource(); if (combo.getSelectedIndex() == 1) { browse.setEnabled(true); adress.setEnabled(true); adress.setEditable(true); } else { browse.setEnabled(false); adress.setEnabled(false); adress.setEditable(false); } gs.set("type", combo.getSelectedIndex()); } }); subTypePanel.add(type); JPanel typePanel = new JPanel(); typePanel.setLayout(new BoxLayout(typePanel, BoxLayout.PAGE_AXIS)); typePanel.add(subTypePanel); JPanel browsePanel = new JPanel(); browsePanel.add(browse); JPanel adressPanel = new JPanel(); adressPanel.setLayout(new BoxLayout(adressPanel, BoxLayout.PAGE_AXIS)); JLabel adressLabel = new JLabel("Adresse de tlchargement :"); adressPanel.setPreferredSize(new Dimension(0, 47)); adress.setPreferredSize(new Dimension(0, 30)); adressPanel.add(adressLabel); adressPanel.add(adress); typePanel.add(adressPanel); this.add(typePanel); closeOnStart.setSelected(true); closeOnStart.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { if (closeOnStart.isSelected()) { gs.set("close", true); } else { gs.set("close", false); } } }); this.add(closeOnStart); JPanel look = new JPanel(); look.setBorder(BorderFactory.createTitledBorder("Apparence")); look.setPreferredSize(new Dimension(290, 340)); JPanel colors = new JPanel(); cDark.setSelected(true); bg.add(cLight); bg.add(cDark); colors.add(cLight); colors.add(cDark); cLight.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { gs.set("color", 0); } }); cDark.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { gs.set("color", 1); } }); look.add(colors); JPanel checks = new JPanel(); checks.setLayout(new BoxLayout(checks, BoxLayout.PAGE_AXIS)); borders.setSelected(true); borders.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { if (borders.isSelected()) { gs.set("borders", true); } else { gs.set("borders", false); } } }); resize.setSelected(true); resize.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { if (resize.isSelected()) { gs.set("resizable", true); } else { gs.set("resizable", false); } } }); alwaysOnTop.setSelected(false); alwaysOnTop.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { if (alwaysOnTop.isSelected()) { gs.set("top", true); } else { gs.set("top", false); } } }); checks.add(borders); checks.add(resize); checks.add(alwaysOnTop); checks.setPreferredSize(new Dimension(270, 60)); JPanel size = new JPanel(); width.setPreferredSize(new Dimension(57, 30)); widthMin.setPreferredSize(new Dimension(57, 30)); widthMax.setPreferredSize(new Dimension(57, 30)); height.setPreferredSize(new Dimension(57, 30)); heightMin.setPreferredSize(new Dimension(57, 30)); heightMax.setPreferredSize(new Dimension(57, 30)); JPanel widthPanel = new JPanel(); widthPanel.setPreferredSize(new Dimension(130, 150)); widthPanel.setBorder(BorderFactory.createTitledBorder("Largeur")); widthPanel.setLayout(new BoxLayout(widthPanel, BoxLayout.PAGE_AXIS)); JPanel widthPanelBase = new JPanel(); widthPanelBase.add(new JLabel("Base :")); widthPanelBase.add(width); JPanel widthPanelMin = new JPanel(); widthPanelMin.add(new JLabel("Min :")); widthPanelMin.add(Box.createRigidArea(new Dimension(5, 1))); widthPanelMin.add(widthMin); JPanel widthPanelMax = new JPanel(); widthPanelMax.add(new JLabel("Max :")); widthPanelMax.add(Box.createRigidArea(new Dimension(3, 1))); widthPanelMax.add(widthMax); widthPanel.add(widthPanelBase); widthPanel.add(widthPanelMin); widthPanel.add(widthPanelMax); JPanel heightPanel = new JPanel(); heightPanel.setPreferredSize(new Dimension(130, 150)); heightPanel.setBorder(BorderFactory.createTitledBorder("Hauteur")); heightPanel.setLayout(new BoxLayout(heightPanel, BoxLayout.PAGE_AXIS)); JPanel heightPanelBase = new JPanel(); heightPanelBase.add(new JLabel("Base :")); heightPanelBase.add(height); JPanel heightPanelMin = new JPanel(); heightPanelMin.add(new JLabel("Min :")); heightPanelMin.add(Box.createRigidArea(new Dimension(5, 1))); heightPanelMin.add(heightMin); JPanel heightPanelMax = new JPanel(); heightPanelMax.add(new JLabel("Max :")); heightPanelMax.add(Box.createRigidArea(new Dimension(3, 1))); heightPanelMax.add(heightMax); heightPanel.add(heightPanelBase); heightPanel.add(heightPanelMin); heightPanel.add(heightPanelMax); size.add(widthPanel); size.add(heightPanel); width.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { JSpinner spinner = (JSpinner) e.getSource(); gs.set("width", spinner.getValue()); } }); widthMin.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { JSpinner spinner = (JSpinner) e.getSource(); gs.set("widthMin", spinner.getValue()); } }); widthMax.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { JSpinner spinner = (JSpinner) e.getSource(); ; gs.set("widthMax", spinner.getValue()); } }); height.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { JSpinner spinner = (JSpinner) e.getSource(); gs.set("height", spinner.getValue()); } }); heightMin.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { JSpinner spinner = (JSpinner) e.getSource(); gs.set("heightMin", spinner.getValue()); } }); heightMax.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { JSpinner spinner = (JSpinner) e.getSource(); ; gs.set("heightMax", spinner.getValue()); } }); look.add(checks); look.add(size); JPanel bottom = new JPanel(); bottom.setLayout(new BoxLayout(bottom, BoxLayout.LINE_AXIS)); JButton music = new JButton("Ajouter de la musique"); music.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { new MusicFrame((JFrame) SwingUtilities.windowForComponent(adress), gs); } }); bottom.add(music); JButton icons = new JButton("Icnes"); icons.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { new IconFrame((JFrame) SwingUtilities.windowForComponent(adress)); } }); bottom.add(icons); look.add(bottom); this.add(look); load(); }
From source file:org.isatools.isacreator.wizard.MicroarrayCreationAlgorithm.java
private JPanel instantiatePanel() { final JPanel microArrayQuestionCont = new JPanel(); microArrayQuestionCont.setLayout(new BoxLayout(microArrayQuestionCont, BoxLayout.PAGE_AXIS)); microArrayQuestionCont.setOpaque(false); StringBuilder text = new StringBuilder("<html><b>" + assay.getMeasurementEndpoint() + "</b> using <b>" + assay.getTechnologyType() + "</b>"); if (!StringUtils.isEmpty(assay.getAssayPlatform())) { text.append(" on <b>").append(assay.getAssayPlatform()).append("</b>"); }/* ww w .jav a2s . c o m*/ JLabel info = new JLabel(text.append("</html>").toString(), JLabel.LEFT); UIHelper.renderComponent(info, UIHelper.VER_12_PLAIN, UIHelper.GREY_COLOR, false); info.setPreferredSize(new Dimension(300, 40)); JPanel infoPanel = new JPanel(new GridLayout(1, 1)); infoPanel.setOpaque(false); infoPanel.add(info); microArrayQuestionCont.add(infoPanel); // create reference sample used checkbox JPanel labelPanel = new JPanel(new GridLayout(2, 2)); labelPanel.setBackground(UIHelper.BG_COLOR); final DataEntryForm studyUISection = ApplicationManager.getUserInterfaceForISASection(study); System.out.println("Study user interface is null? " + (studyUISection == null)); System.out .println("Study user interface dep is null? " + (studyUISection.getDataEntryEnvironment() == null)); label1Capture = new LabelCapture("Label (e.g. Cy3)"); label2Capture = new LabelCapture("Label (e.g. Cy5)"); label2Capture.setVisible(false); // create dye swap check box dyeSwapUsed = new JCheckBox("dye-swap performed?", false); UIHelper.renderComponent(dyeSwapUsed, UIHelper.VER_12_BOLD, UIHelper.DARK_GREEN_COLOR, false); dyeSwapUsed.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { label2Capture.setVisible(dyeSwapUsed.isSelected()); } }); labelPanel.add(UIHelper.createLabel("Label(s) used")); labelPanel.add(label1Capture); labelPanel.add(dyeSwapUsed); labelPanel.add(label2Capture); microArrayQuestionCont.add(labelPanel); final JPanel extractPanel = new JPanel(new GridLayout(2, 2)); extractPanel.setOpaque(false); extractDetails.clear(); JLabel extractsUsedLab = UIHelper.createLabel("sample(s) used *"); extractsUsedLab.setHorizontalAlignment(JLabel.LEFT); extractsUsedLab.setVerticalAlignment(JLabel.TOP); final JPanel extractNameContainer = new JPanel(); extractNameContainer.setLayout(new BoxLayout(extractNameContainer, BoxLayout.PAGE_AXIS)); extractNameContainer.setOpaque(false); extract = new ExtractDetailsCapture("Sample " + (extractDetails.size() + 1), studyUISection.getDataEntryEnvironment()); extractDetails.add(extract); extractNameContainer.add(extract); JLabel addExtractButton = new JLabel("add sample", addRecordIcon, JLabel.RIGHT); UIHelper.renderComponent(addExtractButton, UIHelper.VER_12_BOLD, UIHelper.DARK_GREEN_COLOR, false); addExtractButton.setVerticalAlignment(JLabel.TOP); addExtractButton.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { extract = new ExtractDetailsCapture("Sample " + (extractDetails.size() + 1), studyUISection.getDataEntryEnvironment()); extractDetails.add(extract); extractNameContainer.add(extract); extractNameContainer.revalidate(); microArrayQuestionCont.revalidate(); } }); addExtractButton.setToolTipText( "<html><b>add new sample</b><p>add another sample (e.g. Liver, Heart, Urine, Blood)</p></html>"); JLabel removeExtractButton = new JLabel("remove sample", removeIcon, JLabel.RIGHT); removeExtractButton.setVerticalAlignment(JLabel.TOP); UIHelper.renderComponent(removeExtractButton, UIHelper.VER_12_BOLD, UIHelper.DARK_GREEN_COLOR, false); removeExtractButton.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if (extractDetails.size() > 1) { extract = extractDetails.get(extractDetails.size() - 1); extractDetails.remove(extract); extractNameContainer.remove(extract); microArrayQuestionCont.revalidate(); } } }); removeExtractButton.setToolTipText( "<html><b>remove previously added sample</b><p>remove the array design field last added</p></html>"); extractPanel.add(extractsUsedLab); extractPanel.add(extractNameContainer); JPanel extractButtonContainer = new JPanel(new GridLayout(1, 2)); extractButtonContainer.setOpaque(false); extractButtonContainer.add(addExtractButton); extractButtonContainer.add(removeExtractButton); extractPanel.add(new JLabel()); extractPanel.add(extractButtonContainer); microArrayQuestionCont.add(extractPanel); // ask for array designs used... // create array designs panel final JPanel arrayDesignPanel = new JPanel(new GridLayout(2, 2)); arrayDesignPanel.setOpaque(false); arrayDesignsUsed.clear(); JLabel arrayDesignLab = UIHelper.createLabel("array design(s) used *"); arrayDesignLab.setVerticalAlignment(JLabel.TOP); // the array designs container must adjust to an unknown number of fields. therefore, a JPanel with a BoxLayout // will be used since it is flexible! final JPanel arrayDesignsContainer = new JPanel(); arrayDesignsContainer.setLayout(new BoxLayout(arrayDesignsContainer, BoxLayout.PAGE_AXIS)); arrayDesignsContainer.setOpaque(false); newArrayDesign = new AutoFilterCombo(arrayDesigns, true); UIHelper.renderComponent(newArrayDesign, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false); newArrayDesign.setPreferredSize(new Dimension(70, 30)); arrayDesignsContainer.add(newArrayDesign); arrayDesignsUsed.add(newArrayDesign); JLabel addButton = new JLabel("add design", addRecordIcon, JLabel.RIGHT); UIHelper.renderComponent(addButton, UIHelper.VER_10_PLAIN, UIHelper.DARK_GREEN_COLOR, false); addButton.setVerticalAlignment(JLabel.TOP); addButton.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { newArrayDesign = new AutoFilterCombo(arrayDesigns, true); UIHelper.renderComponent(newArrayDesign, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false); newArrayDesign.setPreferredSize(new Dimension(70, 30)); arrayDesignsUsed.add(newArrayDesign); arrayDesignsContainer.add(newArrayDesign); arrayDesignsContainer.revalidate(); microArrayQuestionCont.revalidate(); } }); addButton.setToolTipText("<html><b>add new array design</b><p>add another array design</p></html>"); JLabel removeButton = new JLabel("remove design", removeIcon, JLabel.RIGHT); removeButton.setVerticalAlignment(JLabel.TOP); UIHelper.renderComponent(removeButton, UIHelper.VER_12_BOLD, UIHelper.DARK_GREEN_COLOR, false); removeButton.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if (arrayDesignsUsed.size() > 1) { newArrayDesign = arrayDesignsUsed.get(arrayDesignsUsed.size() - 1); arrayDesignsUsed.remove(newArrayDesign); arrayDesignsContainer.remove(newArrayDesign); arrayDesignPanel.revalidate(); microArrayQuestionCont.validate(); } } }); removeButton.setToolTipText( "<html><b>remove previously added array design</b><p>remove the array design field last added</p></html>"); arrayDesignPanel.add(arrayDesignLab); arrayDesignPanel.add(arrayDesignsContainer); JPanel buttonContainer = new JPanel(new GridLayout(1, 2)); buttonContainer.setOpaque(false); buttonContainer.add(addButton); buttonContainer.add(removeButton); arrayDesignPanel.add(new JLabel()); arrayDesignPanel.add(buttonContainer); microArrayQuestionCont.add(arrayDesignPanel); microArrayQuestionCont.add(Box.createVerticalStrut(5)); microArrayQuestionCont.add(Box.createHorizontalGlue()); microArrayQuestionCont.setBorder(new TitledBorder(new RoundedBorder(UIHelper.DARK_GREEN_COLOR, 9), assay.getAssayReference(), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, UIHelper.VER_12_BOLD, UIHelper.DARK_GREEN_COLOR)); return microArrayQuestionCont; }
From source file:com.rapidminer.template.gui.RoleRequirementSelector.java
public RoleRequirementSelector(final TemplateController controller) { super(new BorderLayout()); setBorder(border);//from w w w.j a va2 s .com this.controller = controller; setBackground(Color.WHITE); updateRequirement(); controller.getModel().addObserver(new Observer() { @Override public void update(Observable o, Object arg) { if (TemplateState.OBSERVER_EVENT_TEMPLATE.equals(arg)) { updateRequirement(); updateComponents(); } else if (TemplateState.OBSERVER_EVENT_ROLES.equals(arg)) { assignSelectionToCombo(); updateComponents(); attributeCombo.repaint(); } else if (TemplateState.OBSERVER_EVENT_INPUT.equals(arg)) { updateAttributes(); } } }); AutoCompleteDecorator.decorate(attributeCombo); AutoCompleteDecorator.decorate(positiveClassCombo); attributeCombo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (areValuesAdjusting) { return; } assignRoles(); } }); positiveClassCombo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (areValuesAdjusting) { return; } assignRoles(); } }); helpLabel.setHorizontalAlignment(SwingConstants.CENTER); add(helpLabel, BorderLayout.PAGE_START); chartPanel = new ChartPanel(null, 250, 250, 100, 100, 360, 360, true, false, false, false, false, false); chartPanel.setMinimumDrawWidth(0); chartPanel.setMaximumDrawWidth(Integer.MAX_VALUE); chartPanel.setMinimumDrawHeight(0); chartPanel.setMaximumDrawHeight(Integer.MAX_VALUE); attributeCombo.setPreferredSize(new Dimension(100, 30)); attributeCombo.setMaximumSize(new Dimension(150, 30)); add(chartPanel, BorderLayout.CENTER); JComponent comboPanel = new JPanel(); comboPanel.setLayout(new BoxLayout(comboPanel, BoxLayout.PAGE_AXIS)); JComponent comboPanelAtt = new JPanel(); comboPanelAtt.setBackground(Color.WHITE); comboPanelAtt.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); JComponent comboPanelClass = new JPanel(); comboPanelClass.setBackground(Color.WHITE); comboPanelClass.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); positiveClassCombo.setPreferredSize(new Dimension(100, 30)); positiveClassCombo.setMaximumSize(new Dimension(150, 30)); positiveClassLabel.setLabelFor(positiveClassCombo); positiveClassLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); positiveClassLabel.setToolTipText(positiveClassLabel.getText()); positiveClassLabel.setHorizontalAlignment(SwingConstants.RIGHT); columnLabel.setLabelFor(attributeCombo); columnLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); columnLabel.setToolTipText(columnLabel.getText()); columnLabel.setHorizontalAlignment(SwingConstants.RIGHT); comboPanelAtt.add(columnLabel); comboPanelAtt.add(attributeCombo); comboPanelClass.add(positiveClassLabel); comboPanelClass.add(positiveClassCombo); comboPanel.add(comboPanelAtt); comboPanel.add(comboPanelClass); add(comboPanel, BorderLayout.SOUTH); updateComponents(); }
From source file:components.ListDialog.java
private ListDialog(Frame frame, Component locationComp, String labelText, String title, Object[] data, String initialValue, String longValue) { super(frame, title, true); //Create and initialize the buttons. JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(this); ///*from w w w . jav a 2s .co m*/ final JButton setButton = new JButton("Set"); setButton.setActionCommand("Set"); setButton.addActionListener(this); getRootPane().setDefaultButton(setButton); //main part of the dialog list = new JList(data) { //Subclass JList to workaround bug 4832765, which can cause the //scroll pane to not let the user easily scroll up to the beginning //of the list. An alternative would be to set the unitIncrement //of the JScrollBar to a fixed value. You wouldn't get the nice //aligned scrolling, but it should work. public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { int row; if (orientation == SwingConstants.VERTICAL && direction < 0 && (row = getFirstVisibleIndex()) != -1) { Rectangle r = getCellBounds(row, row); if ((r.y == visibleRect.y) && (row != 0)) { Point loc = r.getLocation(); loc.y--; int prevIndex = locationToIndex(loc); Rectangle prevR = getCellBounds(prevIndex, prevIndex); if (prevR == null || prevR.y >= r.y) { return 0; } return prevR.height; } } return super.getScrollableUnitIncrement(visibleRect, orientation, direction); } }; list.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); if (longValue != null) { list.setPrototypeCellValue(longValue); //get extra space } list.setLayoutOrientation(JList.HORIZONTAL_WRAP); list.setVisibleRowCount(-1); list.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { setButton.doClick(); //emulate button click } } }); JScrollPane listScroller = new JScrollPane(list); listScroller.setPreferredSize(new Dimension(250, 80)); listScroller.setAlignmentX(LEFT_ALIGNMENT); //Create a container so that we can add a title around //the scroll pane. Can't add a title directly to the //scroll pane because its background would be white. //Lay out the label and scroll pane from top to bottom. JPanel listPane = new JPanel(); listPane.setLayout(new BoxLayout(listPane, BoxLayout.PAGE_AXIS)); JLabel label = new JLabel(labelText); label.setLabelFor(list); listPane.add(label); listPane.add(Box.createRigidArea(new Dimension(0, 5))); listPane.add(listScroller); listPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); //Lay out the buttons from left to right. JPanel buttonPane = new JPanel(); buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS)); buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10)); buttonPane.add(Box.createHorizontalGlue()); buttonPane.add(cancelButton); buttonPane.add(Box.createRigidArea(new Dimension(10, 0))); buttonPane.add(setButton); //Put everything together, using the content pane's BorderLayout. Container contentPane = getContentPane(); contentPane.add(listPane, BorderLayout.CENTER); contentPane.add(buttonPane, BorderLayout.PAGE_END); //Initialize values. setValue(initialValue); pack(); setLocationRelativeTo(locationComp); }
From source file:com.entertailion.java.fling.FlingFrame.java
public FlingFrame(String appId) { super();//from www . j ava 2s . c om this.appId = appId; rampClient = new RampClient(this); addWindowListener(this); simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); Locale locale = Locale.getDefault(); resourceBundle = ResourceBundle.getBundle("com/entertailion/java/fling/resources/resources", locale); setTitle(MessageFormat.format(resourceBundle.getString("fling.title"), Fling.VERSION)); JPanel listPane = new JPanel(); // show list of ChromeCast devices detected on the local network listPane.setLayout(new BoxLayout(listPane, BoxLayout.PAGE_AXIS)); JPanel devicePane = new JPanel(); devicePane.setLayout(new BoxLayout(devicePane, BoxLayout.LINE_AXIS)); deviceList = new JComboBox(); deviceList.addActionListener(this); devicePane.add(deviceList); URL url = ClassLoader.getSystemResource("com/entertailion/java/fling/resources/refresh.png"); ImageIcon icon = new ImageIcon(url, resourceBundle.getString("button.refresh")); refreshButton = new JButton(icon); refreshButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // refresh the list of devices if (deviceList.getItemCount() > 0) { deviceList.setSelectedIndex(0); } discoverDevices(); } }); refreshButton.setToolTipText(resourceBundle.getString("button.refresh")); devicePane.add(refreshButton); url = ClassLoader.getSystemResource("com/entertailion/java/fling/resources/settings.png"); icon = new ImageIcon(url, resourceBundle.getString("settings.title")); settingsButton = new JButton(icon); settingsButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JTextField transcodingExtensions = new JTextField(50); transcodingExtensions.setText(transcodingExtensionValues); JTextField transcodingParameters = new JTextField(50); transcodingParameters.setText(transcodingParameterValues); JPanel myPanel = new JPanel(new BorderLayout()); JPanel labelPanel = new JPanel(new GridLayout(3, 1)); JPanel fieldPanel = new JPanel(new GridLayout(3, 1)); myPanel.add(labelPanel, BorderLayout.WEST); myPanel.add(fieldPanel, BorderLayout.CENTER); labelPanel.add(new JLabel(resourceBundle.getString("transcoding.extensions"), JLabel.RIGHT)); fieldPanel.add(transcodingExtensions); labelPanel.add(new JLabel(resourceBundle.getString("transcoding.parameters"), JLabel.RIGHT)); fieldPanel.add(transcodingParameters); labelPanel.add(new JLabel(resourceBundle.getString("device.manual"), JLabel.RIGHT)); JPanel devicePanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); final JComboBox manualDeviceList = new JComboBox(); if (manualServers.size() == 0) { manualDeviceList.setVisible(false); } else { for (DialServer dialServer : manualServers) { manualDeviceList.addItem(dialServer); } } devicePanel.add(manualDeviceList); JButton addButton = new JButton(resourceBundle.getString("device.manual.add")); addButton.setToolTipText(resourceBundle.getString("device.manual.add.tooltip")); addButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JTextField name = new JTextField(); JTextField ipAddress = new JTextField(); Object[] message = { resourceBundle.getString("device.manual.name") + ":", name, resourceBundle.getString("device.manual.ipaddress") + ":", ipAddress }; int option = JOptionPane.showConfirmDialog(null, message, resourceBundle.getString("device.manual"), JOptionPane.OK_CANCEL_OPTION); if (option == JOptionPane.OK_OPTION) { try { manualServers.add( new DialServer(name.getText(), InetAddress.getByName(ipAddress.getText()))); Object selected = deviceList.getSelectedItem(); int selectedIndex = deviceList.getSelectedIndex(); deviceList.removeAllItems(); deviceList.addItem(resourceBundle.getString("devices.select")); for (DialServer dialServer : servers) { deviceList.addItem(dialServer); } for (DialServer dialServer : manualServers) { deviceList.addItem(dialServer); } deviceList.invalidate(); if (selectedIndex > 0) { deviceList.setSelectedItem(selected); } else { if (deviceList.getItemCount() == 2) { // Automatically select single device deviceList.setSelectedIndex(1); } } manualDeviceList.removeAllItems(); for (DialServer dialServer : manualServers) { manualDeviceList.addItem(dialServer); } manualDeviceList.setVisible(true); storeProperties(); } catch (UnknownHostException e1) { Log.e(LOG_TAG, "manual IP address", e1); JOptionPane.showMessageDialog(FlingFrame.this, resourceBundle.getString("device.manual.invalidip")); } } } }); devicePanel.add(addButton); JButton removeButton = new JButton(resourceBundle.getString("device.manual.remove")); removeButton.setToolTipText(resourceBundle.getString("device.manual.remove.tooltip")); removeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Object selected = manualDeviceList.getSelectedItem(); manualDeviceList.removeItem(selected); if (manualDeviceList.getItemCount() == 0) { manualDeviceList.setVisible(false); } deviceList.removeItem(selected); deviceList.invalidate(); manualServers.remove(selected); storeProperties(); } }); devicePanel.add(removeButton); fieldPanel.add(devicePanel); int result = JOptionPane.showConfirmDialog(FlingFrame.this, myPanel, resourceBundle.getString("settings.title"), JOptionPane.OK_CANCEL_OPTION); if (result == JOptionPane.OK_OPTION) { transcodingParameterValues = transcodingParameters.getText(); transcodingExtensionValues = transcodingExtensions.getText(); storeProperties(); } } }); settingsButton.setToolTipText(resourceBundle.getString("settings.title")); devicePane.add(settingsButton); listPane.add(devicePane); // TODO volume = new JSlider(JSlider.VERTICAL, 0, 100, 0); volume.setUI(new MySliderUI(volume)); volume.setMajorTickSpacing(25); // volume.setMinorTickSpacing(5); volume.setPaintTicks(true); volume.setEnabled(true); volume.setValue(100); volume.setToolTipText(resourceBundle.getString("volume.title")); volume.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { JSlider source = (JSlider) e.getSource(); if (!source.getValueIsAdjusting()) { int position = (int) source.getValue(); rampClient.volume(position / 100.0f); } } }); JPanel centerPanel = new JPanel(new BorderLayout()); // centerPanel.add(volume, BorderLayout.WEST); centerPanel.add(DragHereIcon.makeUI(this), BorderLayout.CENTER); listPane.add(centerPanel); scrubber = new JSlider(JSlider.HORIZONTAL, 0, 100, 0); scrubber.addChangeListener(this); scrubber.setMajorTickSpacing(25); scrubber.setMinorTickSpacing(5); scrubber.setPaintTicks(true); scrubber.setEnabled(false); listPane.add(scrubber); // panel of playback buttons JPanel buttonPane = new JPanel(); buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS)); label = new JLabel("00:00:00"); buttonPane.add(label); url = ClassLoader.getSystemResource("com/entertailion/java/fling/resources/play.png"); icon = new ImageIcon(url, resourceBundle.getString("button.play")); playButton = new JButton(icon); playButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { rampClient.play(); } }); buttonPane.add(playButton); url = ClassLoader.getSystemResource("com/entertailion/java/fling/resources/pause.png"); icon = new ImageIcon(url, resourceBundle.getString("button.pause")); pauseButton = new JButton(icon); pauseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { rampClient.pause(); } }); buttonPane.add(pauseButton); url = ClassLoader.getSystemResource("com/entertailion/java/fling/resources/stop.png"); icon = new ImageIcon(url, resourceBundle.getString("button.stop")); stopButton = new JButton(icon); stopButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { rampClient.stop(); setDuration(0); scrubber.setValue(0); scrubber.setEnabled(false); } }); buttonPane.add(stopButton); listPane.add(buttonPane); getContentPane().add(listPane); createProgressDialog(); startWebserver(); discoverDevices(); }