List of usage examples for javax.swing BorderFactory createEmptyBorder
public static Border createEmptyBorder(int top, int left, int bottom, int right)
From source file:gg.pistol.sweeper.gui.component.DecoratedPanel.java
private void addSideImage() { JPanel panel = createVerticalPanel(); panel.add(new JLabel(sideImage)); panel.add(Box.createVerticalGlue()); if (ComponentOrientation.getOrientation(i18n.getLocale()).isLeftToRight()) { panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, border)); add(panel, BorderLayout.WEST); } else {//w ww . j av a2 s . com panel.setBorder(BorderFactory.createEmptyBorder(0, border, 0, 0)); add(panel, BorderLayout.EAST); } }
From source file:guineu.util.dialogs.AxesSetupDialog.java
/** * Constructor//w w w . j a va 2 s .co m */ public AxesSetupDialog(XYPlot plot) { // Make dialog modal super(GuineuCore.getDesktop().getMainFrame(), true); xAxis = plot.getDomainAxis(); yAxis = plot.getRangeAxis(); NumberFormat defaultFormatter = NumberFormat.getNumberInstance(); NumberFormat xAxisFormatter = defaultFormatter; if (xAxis instanceof NumberAxis) { xAxisFormatter = ((NumberAxis) xAxis).getNumberFormatOverride(); } NumberFormat yAxisFormatter = defaultFormatter; if (yAxis instanceof NumberAxis) { yAxisFormatter = ((NumberAxis) yAxis).getNumberFormatOverride(); } // Create labels and fields JLabel lblXTitle = new JLabel(xAxis.getLabel()); JLabel lblXAutoRange = new JLabel("Auto range"); JLabel lblXMin = new JLabel("Minimum"); JLabel lblXMax = new JLabel("Maximum"); JLabel lblXAutoTick = new JLabel("Auto tick size"); JLabel lblXTick = new JLabel("Tick size"); JLabel lblYTitle = new JLabel(yAxis.getLabel()); JLabel lblYAutoRange = new JLabel("Auto range"); JLabel lblYMin = new JLabel("Minimum"); JLabel lblYMax = new JLabel("Maximum"); JLabel lblYAutoTick = new JLabel("Auto tick size"); JLabel lblYTick = new JLabel("Tick size"); checkXAutoRange = new JCheckBox(); checkXAutoRange.addActionListener(this); checkXAutoTick = new JCheckBox(); checkXAutoTick.addActionListener(this); fieldXMin = new JFormattedTextField(xAxisFormatter); fieldXMax = new JFormattedTextField(xAxisFormatter); fieldXTick = new JFormattedTextField(xAxisFormatter); checkYAutoRange = new JCheckBox(); checkYAutoRange.addActionListener(this); checkYAutoTick = new JCheckBox(); checkYAutoTick.addActionListener(this); fieldYMin = new JFormattedTextField(yAxisFormatter); fieldYMax = new JFormattedTextField(yAxisFormatter); fieldYTick = new JFormattedTextField(yAxisFormatter); // Create a panel for labels and fields JPanel pnlLabelsAndFields = new JPanel(new GridLayout(0, 2)); pnlLabelsAndFields.add(lblXTitle); pnlLabelsAndFields.add(new JPanel()); pnlLabelsAndFields.add(lblXAutoRange); pnlLabelsAndFields.add(checkXAutoRange); pnlLabelsAndFields.add(lblXMin); pnlLabelsAndFields.add(fieldXMin); pnlLabelsAndFields.add(lblXMax); pnlLabelsAndFields.add(fieldXMax); if (xAxis instanceof NumberAxis) { pnlLabelsAndFields.add(lblXAutoTick); pnlLabelsAndFields.add(checkXAutoTick); pnlLabelsAndFields.add(lblXTick); pnlLabelsAndFields.add(fieldXTick); } // Empty row pnlLabelsAndFields.add(new JPanel()); pnlLabelsAndFields.add(new JPanel()); pnlLabelsAndFields.add(lblYTitle); pnlLabelsAndFields.add(new JPanel()); pnlLabelsAndFields.add(lblYAutoRange); pnlLabelsAndFields.add(checkYAutoRange); pnlLabelsAndFields.add(lblYMin); pnlLabelsAndFields.add(fieldYMin); pnlLabelsAndFields.add(lblYMax); pnlLabelsAndFields.add(fieldYMax); if (yAxis instanceof NumberAxis) { pnlLabelsAndFields.add(lblYAutoTick); pnlLabelsAndFields.add(checkYAutoTick); pnlLabelsAndFields.add(lblYTick); pnlLabelsAndFields.add(fieldYTick); } // Create buttons JPanel pnlButtons = new JPanel(); btnOK = new JButton("OK"); btnOK.addActionListener(this); btnApply = new JButton("Apply"); btnApply.addActionListener(this); btnCancel = new JButton("Cancel"); btnCancel.addActionListener(this); pnlButtons.add(btnOK); pnlButtons.add(btnApply); pnlButtons.add(btnCancel); // Put everything into a main panel JPanel pnlAll = new JPanel(new BorderLayout()); pnlAll.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); add(pnlAll); pnlAll.add(pnlLabelsAndFields, BorderLayout.CENTER); pnlAll.add(pnlButtons, BorderLayout.SOUTH); pack(); setTitle("Please set ranges for axes"); setResizable(false); setLocationRelativeTo(GuineuCore.getDesktop().getMainFrame()); getValuesToControls(); }
From source file:FontChooser.java
private void createUserInterface() { final JPanel content = new JPanel(new GridBagLayout()); final GridBagConstraints gbc = new GridBagConstraints(); setContentPane(content);// ww w . ja va 2s. co m content.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(2, 2, 2, 2); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridx = gbc.gridy = 0; content.add(new JLabel("Font"), gbc); ++gbc.gridx; content.add(new JLabel("Size"), gbc); if (_selectStyles) { ++gbc.gridx; content.add(new JLabel("Style"), gbc); } ++gbc.gridy; gbc.gridx = 0; _fontNamesCmb = new JComboBox( GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames()); content.add(_fontNamesCmb, gbc); ++gbc.gridx; _fontSizesCmb.setEditable(true); content.add(_fontSizesCmb, gbc); if (_selectStyles) { ++gbc.gridx; content.add(_boldChk, gbc); ++gbc.gridy; content.add(_italicChk, gbc); } gbc.gridx = 0; ++gbc.gridy; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.fill = GridBagConstraints.BOTH; gbc.anchor = GridBagConstraints.CENTER; content.add(createPreviewPanel(), gbc); ++gbc.gridy; gbc.fill = GridBagConstraints.HORIZONTAL; content.add(createButtonsPanel(), gbc); pack(); setResizable(true); }
From source file:com.opendoorlogistics.components.reports.ReporterPanel.java
/** * @param title/*w w w. j a v a 2 s. c om*/ * @return */ private Border createBorder(String title) { return BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5), BorderFactory.createTitledBorder(title)); }
From source file:hspc.submissionsprogram.AppDisplay.java
AppDisplay() { this.setTitle("Dominion High School Programming Contest"); this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); this.setResizable(false); WindowListener exitListener = new WindowAdapter() { @Override/* w w w . ja v a2 s . c o m*/ public void windowClosing(WindowEvent e) { System.exit(0); } }; this.addWindowListener(exitListener); JTabbedPane pane = new JTabbedPane(); this.add(pane); JPanel submitPanel = new JPanel(null); submitPanel.setPreferredSize(new Dimension(500, 500)); UIManager.put("FileChooser.readOnly", true); JFileChooser fileChooser = new JFileChooser(); fileChooser.setBounds(0, 0, 500, 350); fileChooser.setVisible(true); FileNameExtensionFilter javaFilter = new FileNameExtensionFilter("Java files (*.java)", "java"); fileChooser.setFileFilter(javaFilter); fileChooser.setAcceptAllFileFilterUsed(false); fileChooser.setControlButtonsAreShown(false); submitPanel.add(fileChooser); JSeparator separator1 = new JSeparator(); separator1.setBounds(12, 350, 476, 2); separator1.setForeground(new Color(122, 138, 152)); submitPanel.add(separator1); JLabel problemChooserLabel = new JLabel("Problem:"); problemChooserLabel.setBounds(12, 360, 74, 25); submitPanel.add(problemChooserLabel); String[] listOfProblems = Main.Configuration.get("problem_names") .split(Main.Configuration.get("name_delimiter")); JComboBox problems = new JComboBox<>(listOfProblems); problems.setBounds(96, 360, 393, 25); submitPanel.add(problems); JButton submit = new JButton("Submit"); submit.setBounds(170, 458, 160, 30); submit.addActionListener(e -> { try { File file = fileChooser.getSelectedFile(); try { CloseableHttpClient httpClient = HttpClients.createDefault(); HttpPost uploadFile = new HttpPost(Main.Configuration.get("submit_url")); MultipartEntityBuilder builder = MultipartEntityBuilder.create(); builder.addTextBody("accountID", Main.accountID, ContentType.TEXT_PLAIN); builder.addTextBody("problem", String.valueOf(problems.getSelectedItem()), ContentType.TEXT_PLAIN); builder.addBinaryBody("submission", file, ContentType.APPLICATION_OCTET_STREAM, file.getName()); HttpEntity multipart = builder.build(); uploadFile.setEntity(multipart); CloseableHttpResponse response = httpClient.execute(uploadFile); HttpEntity responseEntity = response.getEntity(); String inputLine; BufferedReader br = new BufferedReader(new InputStreamReader(responseEntity.getContent())); try { if ((inputLine = br.readLine()) != null) { int rowIndex = Integer.parseInt(inputLine); new ResultWatcher(rowIndex); } br.close(); } catch (IOException ex) { ex.printStackTrace(); } } catch (Exception ex) { ex.printStackTrace(); } } catch (NullPointerException ex) { JOptionPane.showMessageDialog(this, "No file selected.\nPlease select a java file.", "Error", JOptionPane.WARNING_MESSAGE); } }); submitPanel.add(submit); JPanel clarificationsPanel = new JPanel(null); clarificationsPanel.setPreferredSize(new Dimension(500, 500)); cList = new JList<>(); cList.setBounds(12, 12, 476, 200); cList.setBorder(new CompoundBorder(BorderFactory.createLineBorder(new Color(122, 138, 152)), BorderFactory.createEmptyBorder(8, 8, 8, 8))); cList.setBackground(new Color(254, 254, 255)); clarificationsPanel.add(cList); JButton viewC = new JButton("View"); viewC.setBounds(12, 224, 232, 25); viewC.addActionListener(e -> { if (cList.getSelectedIndex() != -1) { int id = Integer.parseInt(cList.getSelectedValue().split("\\.")[0]); clarificationDatas.stream().filter(data -> data.getId() == id).forEach( data -> new ClarificationDisplay(data.getProblem(), data.getText(), data.getResponse())); } }); clarificationsPanel.add(viewC); JButton refreshC = new JButton("Refresh"); refreshC.setBounds(256, 224, 232, 25); refreshC.addActionListener(e -> updateCList(true)); clarificationsPanel.add(refreshC); JSeparator separator2 = new JSeparator(); separator2.setBounds(12, 261, 476, 2); separator2.setForeground(new Color(122, 138, 152)); clarificationsPanel.add(separator2); JLabel problemChooserLabelC = new JLabel("Problem:"); problemChooserLabelC.setBounds(12, 273, 74, 25); clarificationsPanel.add(problemChooserLabelC); JComboBox problemsC = new JComboBox<>(listOfProblems); problemsC.setBounds(96, 273, 393, 25); clarificationsPanel.add(problemsC); JTextArea textAreaC = new JTextArea(); textAreaC.setLineWrap(true); textAreaC.setWrapStyleWord(true); textAreaC.setBorder(new CompoundBorder(BorderFactory.createLineBorder(new Color(122, 138, 152)), BorderFactory.createEmptyBorder(8, 8, 8, 8))); textAreaC.setBackground(new Color(254, 254, 255)); JScrollPane areaScrollPane = new JScrollPane(textAreaC); areaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); areaScrollPane.setBounds(12, 312, 477, 134); clarificationsPanel.add(areaScrollPane); JButton submitC = new JButton("Submit Clarification"); submitC.setBounds(170, 458, 160, 30); submitC.addActionListener(e -> { if (textAreaC.getText().length() > 2048) { JOptionPane.showMessageDialog(this, "Clarification body is too long.\nMaximum of 2048 characters allowed.", "Error", JOptionPane.WARNING_MESSAGE); } else if (textAreaC.getText().length() < 20) { JOptionPane.showMessageDialog(this, "Clarification body is too short.\nClarifications must be at least 20 characters, but no more than 2048.", "Error", JOptionPane.WARNING_MESSAGE); } else { Connection conn = null; PreparedStatement stmt = null; try { Class.forName(JDBC_DRIVER); conn = DriverManager.getConnection(Main.Configuration.get("jdbc_mysql_address"), Main.Configuration.get("mysql_user"), Main.Configuration.get("mysql_pass")); String sql = "INSERT INTO clarifications (team, problem, text) VALUES (?, ?, ?)"; stmt = conn.prepareStatement(sql); stmt.setInt(1, Integer.parseInt(String.valueOf(Main.accountID))); stmt.setString(2, String.valueOf(problemsC.getSelectedItem())); stmt.setString(3, String.valueOf(textAreaC.getText())); textAreaC.setText(""); stmt.executeUpdate(); stmt.close(); conn.close(); updateCList(false); } catch (Exception ex) { ex.printStackTrace(); } finally { try { if (stmt != null) { stmt.close(); } } catch (Exception ex2) { ex2.printStackTrace(); } try { if (conn != null) { conn.close(); } } catch (Exception ex2) { ex2.printStackTrace(); } } } }); clarificationsPanel.add(submitC); pane.addTab("Submit", submitPanel); pane.addTab("Clarifications", clarificationsPanel); Timer timer = new Timer(); TimerTask updateTask = new TimerTask() { @Override public void run() { updateCList(false); } }; timer.schedule(updateTask, 10000, 10000); updateCList(false); this.pack(); this.setLocationRelativeTo(null); this.setVisible(true); }
From source file:net.pms.encoders.AviSynthMEncoder.java
@Override public JComponent config() { FormLayout layout = new FormLayout("left:pref, 0:grow", "p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 12dlu, p, 3dlu, 0:grow"); PanelBuilder builder = new PanelBuilder(layout); builder.border(Borders.EMPTY);/*from www .j a v a 2 s. co m*/ builder.opaque(false); CellConstraints cc = new CellConstraints(); JComponent cmp = builder.addSeparator(Messages.getString("NetworkTab.5"), cc.xyw(2, 1, 1)); cmp = (JComponent) cmp.getComponent(0); cmp.setFont(cmp.getFont().deriveFont(Font.BOLD)); multithreading = new JCheckBox(Messages.getString("MEncoderVideo.35"), configuration.getAvisynthMultiThreading()); multithreading.setContentAreaFilled(false); multithreading.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setAvisynthMultiThreading((e.getStateChange() == ItemEvent.SELECTED)); } }); builder.add(GuiUtil.getPreferredSizeComponent(multithreading), cc.xy(2, 3)); interframe = new JCheckBox(Messages.getString("AviSynthMEncoder.13"), configuration.getAvisynthInterFrame()); interframe.setContentAreaFilled(false); interframe.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { configuration.setAvisynthInterFrame(interframe.isSelected()); if (configuration.getAvisynthInterFrame()) { JOptionPane.showMessageDialog( SwingUtilities.getWindowAncestor((Component) PMS.get().getFrame()), Messages.getString("AviSynthMEncoder.16"), Messages.getString("Dialog.Information"), JOptionPane.INFORMATION_MESSAGE); } } }); builder.add(GuiUtil.getPreferredSizeComponent(interframe), cc.xy(2, 5)); interframegpu = new JCheckBox(Messages.getString("AviSynthMEncoder.15"), configuration.getAvisynthInterFrameGPU()); interframegpu.setContentAreaFilled(false); interframegpu.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setAvisynthInterFrameGPU((e.getStateChange() == ItemEvent.SELECTED)); } }); builder.add(GuiUtil.getPreferredSizeComponent(interframegpu), cc.xy(2, 7)); convertfps = new JCheckBox(Messages.getString("AviSynthMEncoder.3"), configuration.getAvisynthConvertFps()); convertfps.setContentAreaFilled(false); convertfps.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setAvisynthConvertFps((e.getStateChange() == ItemEvent.SELECTED)); } }); builder.add(GuiUtil.getPreferredSizeComponent(convertfps), cc.xy(2, 9)); String aviSynthScriptInstructions = Messages.getString("AviSynthMEncoder.4") + Messages.getString("AviSynthMEncoder.5") + Messages.getString("AviSynthMEncoder.6") + Messages.getString("AviSynthMEncoder.7") + Messages.getString("AviSynthMEncoder.8"); JTextArea aviSynthScriptInstructionsContainer = new JTextArea(aviSynthScriptInstructions); aviSynthScriptInstructionsContainer.setEditable(false); aviSynthScriptInstructionsContainer.setBorder(BorderFactory.createEtchedBorder()); aviSynthScriptInstructionsContainer.setBackground(new Color(255, 255, 192)); aviSynthScriptInstructionsContainer.setBorder( BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(new Color(130, 135, 144)), BorderFactory.createEmptyBorder(3, 5, 3, 5))); builder.add(aviSynthScriptInstructionsContainer, cc.xy(2, 11)); String clip = configuration.getAvisynthScript(); if (clip == null) { clip = ""; } StringBuilder sb = new StringBuilder(); StringTokenizer st = new StringTokenizer(clip, PMS.AVS_SEPARATOR); int i = 0; while (st.hasMoreTokens()) { if (i > 0) { sb.append("\n"); } sb.append(st.nextToken()); i++; } textArea = new JTextArea(sb.toString()); textArea.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { StringBuilder sb = new StringBuilder(); StringTokenizer st = new StringTokenizer(textArea.getText(), "\n"); int i = 0; while (st.hasMoreTokens()) { if (i > 0) { sb.append(PMS.AVS_SEPARATOR); } sb.append(st.nextToken()); i++; } configuration.setAvisynthScript(sb.toString()); } }); JScrollPane pane = new JScrollPane(textArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); pane.setPreferredSize(new Dimension(500, 350)); builder.add(pane, cc.xy(2, 13)); configuration.addConfigurationListener(new ConfigurationListener() { @Override public void configurationChanged(ConfigurationEvent event) { if (event.getPropertyName() == null) { return; } if ((!event.isBeforeUpdate()) && event.getPropertyName().equals(PmsConfiguration.KEY_GPU_ACCELERATION)) { interframegpu.setEnabled(configuration.isGPUAcceleration()); } } }); return builder.getPanel(); }
From source file:DragPictureDemo2.java
public DragPictureDemo2() { super(new BorderLayout()); picHandler = new PictureTransferHandler(); //Since we are using keyboard accelerators, we don't //need the component to install its own input map //bindings.//from w w w .ja v a 2 s .co m DTPicture.setInstallInputMapBindings(false); JPanel mugshots = new JPanel(new GridLayout(4, 3)); pic1 = new DTPicture(createImageIcon("images/" + mayaString + ".jpg", mayaString).getImage()); pic1.setTransferHandler(picHandler); mugshots.add(pic1); pic2 = new DTPicture(createImageIcon("images/" + anyaString + ".jpg", anyaString).getImage()); pic2.setTransferHandler(picHandler); mugshots.add(pic2); pic3 = new DTPicture(createImageIcon("images/" + laineString + ".jpg", laineString).getImage()); pic3.setTransferHandler(picHandler); mugshots.add(pic3); pic4 = new DTPicture(createImageIcon("images/" + cosmoString + ".jpg", cosmoString).getImage()); pic4.setTransferHandler(picHandler); mugshots.add(pic4); pic5 = new DTPicture(createImageIcon("images/" + adeleString + ".jpg", adeleString).getImage()); pic5.setTransferHandler(picHandler); mugshots.add(pic5); pic6 = new DTPicture(createImageIcon("images/" + alexiString + ".jpg", alexiString).getImage()); pic6.setTransferHandler(picHandler); mugshots.add(pic6); //These six components with no pictures provide handy //drop targets. pic7 = new DTPicture(null); pic7.setTransferHandler(picHandler); mugshots.add(pic7); pic8 = new DTPicture(null); pic8.setTransferHandler(picHandler); mugshots.add(pic8); pic9 = new DTPicture(null); pic9.setTransferHandler(picHandler); mugshots.add(pic9); pic10 = new DTPicture(null); pic10.setTransferHandler(picHandler); mugshots.add(pic10); pic11 = new DTPicture(null); pic11.setTransferHandler(picHandler); mugshots.add(pic11); pic12 = new DTPicture(null); pic12.setTransferHandler(picHandler); mugshots.add(pic12); setPreferredSize(new Dimension(450, 630)); add(mugshots, BorderLayout.CENTER); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); }
From source file:llc.rockford.webcast.EC2Driver.java
public Component createComponents() { startButton = new JButton("START SERVER"); startButton.setEnabled(false);/*from w ww .j av a 2 s .c o m*/ startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { startButton.setEnabled(false); stopButton.setEnabled(false); new StartInstanceWorker(ec2Handle.getEc2Handle(), applicationState, amazonProperties).execute(); } }); startStreamButton = new JButton("START BROADCAST"); startStreamButton.setEnabled(false); startStreamButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { startStreamButton.setEnabled(false); stopStreamButton.setEnabled(true); try { broadcaster.start(); } catch (ExecuteException e1) { startStreamButton.setEnabled(true); e1.printStackTrace(); } catch (IOException e1) { startStreamButton.setEnabled(true); e1.printStackTrace(); } catch (InterruptedException e1) { e1.printStackTrace(); } } }); stopStreamButton = new JButton("STOP BROADCAST"); stopStreamButton.setEnabled(false); stopStreamButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { broadcaster.stop(); } }); statusLabel.setHorizontalAlignment(SwingConstants.CENTER); statusLabel.setOpaque(true); statusLabel.setBackground(Color.YELLOW); broadcastStatusLabel.setHorizontalAlignment(SwingConstants.CENTER); broadcastStatusLabel.setOpaque(true); broadcastStatusLabel.setBackground(Color.RED); stopButton = new JButton("STOP SERVER"); stopButton.setEnabled(false); stopButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { startButton.setEnabled(false); stopButton.setEnabled(false); new TerminateInstanceWorker(ec2Handle.getEc2Handle(), applicationState, amazonProperties).execute(); } }); JPanel pane = new JPanel(new GridLayout(7, 1)); pane.add(startButton); pane.add(statusLabel); pane.add(stopButton); pane.add(new JSeparator(SwingConstants.HORIZONTAL)); pane.add(startStreamButton); pane.add(broadcastStatusLabel); pane.add(stopStreamButton); pane.setBorder(BorderFactory.createEmptyBorder(30, // top 30, // left 10, // bottom 30) // right ); return pane; }
From source file:net.sf.xmm.moviemanager.gui.DialogIMDbMultiAdd.java
JButton createChooseBetweenImdbAndLocalDatabaseButton() { /*This button choses between IMDB and local movie database*/ final JButton chooseBetweenImdbAndLocalDatabase = new JButton( Localizer.get("DialogIMDbMultiAdd.button.add-to-existing-movie.text")); //$NON-NLS-1$ chooseBetweenImdbAndLocalDatabase//w w w.j a v a 2 s . co m .setToolTipText(Localizer.get("DialogIMDbMultiAdd.button.add-to-existing-movie.tooltip")); //$NON-NLS-1$ chooseBetweenImdbAndLocalDatabase.setActionCommand("GetIMDBInfo - chooseBetweenImdbAndLocalDatabase"); //$NON-NLS-1$ chooseBetweenImdbAndLocalDatabase.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { log.debug("ActionPerformed: " + event.getActionCommand()); //$NON-NLS-1$ if (addInfoToExistingMovie) { getPanelMoviesList().setBorder(BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), Localizer.get("DialogIMDB.panel-movie-list.title")), //$NON-NLS-1$ BorderFactory.createEmptyBorder(5, 5, 5, 5))); chooseBetweenImdbAndLocalDatabase .setText(Localizer.get("DialogIMDbMultiAdd.button.add-to-existing-movie.text")); //$NON-NLS-1$ chooseBetweenImdbAndLocalDatabase.setToolTipText( Localizer.get("DialogIMDbMultiAdd.button.add-to-existing-movie.tooltip")); //$NON-NLS-1$ addInfoToExistingMovie = false; executeSearchMultipleMovies(); } else { executeEditExistingMovie(""); //$NON-NLS-1$ chooseBetweenImdbAndLocalDatabase .setText(Localizer.get("DialogIMDbMultiAdd.button.search-on-IMDb.text")); //$NON-NLS-1$ chooseBetweenImdbAndLocalDatabase .setToolTipText(Localizer.get("DialogIMDbMultiAdd.button.search-on-IMDb.tooltip")); //$NON-NLS-1$ addInfoToExistingMovie = true; getPanelMoviesList().setBorder(BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), Localizer.get("DialogIMDB.panel-your-movie-list.title")), //$NON-NLS-1$ BorderFactory.createEmptyBorder(5, 5, 5, 5))); } } }); return chooseBetweenImdbAndLocalDatabase; }
From source file:LoggerGUI.DataLogger.java
public DataLogger(String title) { super(title); initialize();/*w ww. j a v a 2s . c om*/ final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new DateAxis("Time")); this.datasets = new TimeSeriesCollection[INPUT_COUNT]; this.lastValue[0] = 100.0; this.lastValue[1] = 100.0; this.lastValue[2] = 100.0; this.lastValue[3] = 100.0; final TimeSeries s0 = new TimeSeries("A0", Millisecond.class); final TimeSeries s1 = new TimeSeries("A1", Millisecond.class); final TimeSeries s2 = new TimeSeries("A2", Millisecond.class); final TimeSeries s3 = new TimeSeries("A3", Millisecond.class); this.datasets[0] = new TimeSeriesCollection(s0); this.datasets[1] = new TimeSeriesCollection(s1); this.datasets[2] = new TimeSeriesCollection(s2); this.datasets[3] = new TimeSeriesCollection(s3); final NumberAxis rangeAxis = new NumberAxis("ADC Signal"); rangeAxis.setAutoRangeIncludesZero(false); XYPlot subplot; XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true,false); XYLineAndShapeRenderer renderer1 = new XYLineAndShapeRenderer(true,false); XYLineAndShapeRenderer renderer2 = new XYLineAndShapeRenderer(true,false); XYLineAndShapeRenderer renderer3 = new XYLineAndShapeRenderer(true,false); subplot= new XYPlot( new TimeSeriesCollection(), null, rangeAxis, new XYLineAndShapeRenderer(true,false) ); plot.add(subplot); renderer.setBaseShapesVisible(false); renderer.setSeriesPaint(0, Color.red); subplot.setDataset(0,datasets[0]); subplot.setRenderer(0,renderer); renderer1.setBaseShapesVisible(false); renderer1.setSeriesPaint(0, Color.blue); subplot.setDataset(1,datasets[1]); subplot.setRenderer(1,renderer1); renderer2.setBaseShapesVisible(false); renderer2.setSeriesPaint(0, Color.black); subplot.setDataset(2,datasets[2]); subplot.setRenderer(2,renderer2); subplot.getRendererForDataset(subplot.getDataset(0)).setSeriesPaint(0, Color.red); subplot.getRendererForDataset(subplot.getDataset(1)).setSeriesPaint(1, Color.blue); subplot.getRendererForDataset(subplot.getDataset(2)).setSeriesPaint(2, Color.black); renderer3.setBaseShapesVisible(false); renderer3.setSeriesPaint(0, Color.green); subplot.setDataset(3,datasets[3]); subplot.setRenderer(3,renderer3); final JFreeChart chart = new JFreeChart("Data Logger", plot); chart.setBorderPaint(Color.black); chart.setBorderVisible(true); chart.setBackgroundPaint(Color.white); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); final ValueAxis axis = plot.getDomainAxis(); axis.setAutoRange(true); axis.setFixedAutoRange(20000.0); // 60 seconds final JPanel content = new JPanel(new BorderLayout()); final ChartPanel chartPanel = new ChartPanel(chart); content.add(chartPanel); final JPanel buttonPanel = new JPanel(new FlowLayout()); content.add(buttonPanel, BorderLayout.NORTH); chartPanel.setPreferredSize(new java.awt.Dimension(600, 600)); chartPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); setContentPane(content); }