List of usage examples for javax.swing JLabel setText
@BeanProperty(preferred = true, visualUpdate = true, description = "Defines the single line of text this component will display.") public void setText(String text)
From source file:edu.harvard.i2b2.query.ui.TopPanel.java
private void jMorePanelsButtonActionPerformed(java.awt.event.ActionEvent evt) { if (dataModel.hasEmptyPanels()) { JOptionPane.showMessageDialog(this, "Please use an existing empty panel before adding a new one."); return;/*from ww w .j a va 2 s .c om*/ } int rightmostPosition = dataModel.lastLabelPosition(); JLabel label = new JLabel(); label.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); label.setText("and"); label.setToolTipText("Click to change the relationship"); label.setBorder(javax.swing.BorderFactory.createEtchedBorder()); label.addMouseListener(new java.awt.event.MouseAdapter() { @Override public void mouseClicked(java.awt.event.MouseEvent evt) { jAndOrLabelMouseClicked(evt); } }); ConceptTreePanel panel = new ConceptTreePanel("Group " + (dataModel.getCurrentPanelCount() + 1), this); jPanel1.add(panel); panel.setBounds(rightmostPosition + 5, 0, 180, getParent().getHeight() - 100); jPanel1.setPreferredSize(new Dimension(rightmostPosition + 5 + 181 + 60, getHeight() - 100)); jScrollPane4.setViewportView(jPanel1); dataModel.addPanel(panel, label, rightmostPosition + 5 + 180); /* * System.out.println(jScrollPane4.getViewport().getExtentSize().width+":" * + jScrollPane4.getViewport().getExtentSize().height); * System.out.println * (jScrollPane4.getHorizontalScrollBar().getVisibleRect().width+":" * +jScrollPane4.getHorizontalScrollBar().getVisibleRect().height); * System * .out.println(jScrollPane4.getHorizontalScrollBar().getVisibleAmount * ()); * System.out.println(jScrollPane4.getHorizontalScrollBar().getValue()); */ jScrollPane4.getHorizontalScrollBar().setValue(jScrollPane4.getHorizontalScrollBar().getMaximum()); jScrollPane4.getHorizontalScrollBar().setUnitIncrement(40); // this.jScrollPane4.removeAll(); // this.jScrollPane4.setViewportView(jPanel1); // revalidate(); // jScrollPane3.setBounds(420, 0, 170, 300); // jScrollPane4.setBounds(20, 35, 335, 220); resizePanels(getParent().getWidth(), getParent().getHeight()); }
From source file:org.nebulaframework.ui.swing.cluster.ClusterMainUI.java
/** * Updates UI and displays the Cluster Information. *//*from ww w . j a va2 s. c o m*/ private void showClusterInfo() { ClusterManager mgr = ClusterManager.getInstance(); // ClusterID final JLabel clusterId = getUIElement("general.stats.clusterid"); clusterId.setText(mgr.getClusterId().toString()); // HostInfo JLabel hostInfo = getUIElement("general.stats.hostinfo"); hostInfo.setText(mgr.getClusterInfo().getHostInfo()); // Protocols JLabel protocols = getUIElement("general.stats.protocols"); protocols.setText(mgr.getClusterInfo().getProtocolInfo()); // Uptime Initial Value JLabel upTime = getUIElement("general.stats.uptime"); upTime.setText(""); // Peer Clusters final JLabel clusters = getUIElement("general.stats.peerclusters"); clusters.setText("0"); // Peer Clusters Update Hook ServiceEventsSupport.addServiceHook(new ServiceHookCallback() { public void onServiceEvent(ServiceMessage message) { SwingUtilities.invokeLater(new Runnable() { public void run() { try { int peers = ClusterManager.getInstance().getPeerService().getPeerCount(); clusters.setText(String.valueOf(peers)); } catch (Exception e) { log.warn("[UI] Exception while accessing peer information", e); } } }); } }, ServiceMessageType.PEER_CONNECTION, ServiceMessageType.PEER_DISCONNECTION); // Local Nodes final JLabel nodes = getUIElement("general.stats.nodes"); nodes.setText(String.valueOf(ClusterManager.getInstance().getClusterRegistrationService().getNodeCount())); // Local Nodes Update Hook ServiceEventsSupport.addServiceHook(new ServiceHookCallback() { public void onServiceEvent(ServiceMessage message) { SwingUtilities.invokeLater(new Runnable() { public void run() { int count = ClusterManager.getInstance().getClusterRegistrationService().getNodeCount(); nodes.setText(String.valueOf(count)); } }); } }, ServiceMessageType.NODE_REGISTERED, ServiceMessageType.NODE_UNREGISTERED); // Completed Jobs final JLabel jobsdone = getUIElement("general.stats.jobsdone"); jobsdone.setText("0"); // Completed Jobs Update Hook ServiceEventsSupport.addServiceHook(new ServiceHookCallback() { public void onServiceEvent(ServiceMessage message) { SwingUtilities.invokeLater(new Runnable() { public void run() { int count = ClusterManager.getInstance().getJobService().getFinishedJobCount(); jobsdone.setText(String.valueOf(count)); } }); } }, ServiceMessageType.JOB_END, ServiceMessageType.JOB_CANCEL); // Active Jobs final JLabel activejobs = getUIElement("general.stats.activejobs"); activejobs.setText(String.valueOf(ClusterManager.getInstance().getJobService().getActiveJobCount())); // Active Jobs Update Hook ServiceEventsSupport.addServiceHook(new ServiceHookCallback() { public void onServiceEvent(ServiceMessage message) { SwingUtilities.invokeLater(new Runnable() { public void run() { int count = ClusterManager.getInstance().getJobService().getActiveJobCount(); activejobs.setText(String.valueOf(count)); } }); } }, ServiceMessageType.JOB_START, ServiceMessageType.JOB_CANCEL, ServiceMessageType.JOB_END); // Start Up time Thread Thread t = new Thread(new Runnable() { public void run() { long start = System.currentTimeMillis(); while (true) { try { Thread.sleep(1000); } catch (InterruptedException e) { log.warn("Interrupted Exception in Up Time Thread", e); } final String uptime = TimeUtils.timeDifference(start); SwingUtilities.invokeLater(new Runnable() { public void run() { JLabel upTime = getUIElement("general.stats.uptime"); upTime.setText(uptime); } }); } } }); t.setDaemon(true); t.start(); }
From source file:generadorqr.jifrNuevoQr.java
void CargarVideo(JLabel label, Integer identificador) { int resultado; // ventana = new CargarFoto(); JFileChooser jfchCargarVideo = new JFileChooser(); FileNameExtensionFilter filtro = new FileNameExtensionFilter("MP4", "mp4"); jfchCargarVideo.setFileFilter(filtro); resultado = jfchCargarVideo.showOpenDialog(null); if (JFileChooser.APPROVE_OPTION == resultado) { fichero = jfchCargarVideo.getSelectedFile(); try {// ww w . j av a 2 s. co m tempVideo = fichero.getPath(); tempNombreMultimedia[identificador] = fichero.getName(); label.setText(tempNombreMultimedia[identificador]); if (label.getText().length() > 10) label.setText(tempNombreMultimedia[identificador].substring(0, 10) + "...mp4"); } catch (Exception ex) { JOptionPane.showMessageDialog(null, "Error abriendo la imagen" + ex); } } }
From source file:generadorqr.jifrNuevoQr.java
void CargarAudio(JLabel label, Integer identificador) { int resultado; // ventana = new CargarFoto(); JFileChooser jfchCargarVideo = new JFileChooser(); FileNameExtensionFilter filtro = new FileNameExtensionFilter("MP3", "mp3"); jfchCargarVideo.setFileFilter(filtro); resultado = jfchCargarVideo.showOpenDialog(null); if (JFileChooser.APPROVE_OPTION == resultado) { fichero = jfchCargarVideo.getSelectedFile(); try {//from ww w .j a va 2 s . c om tempAudio = fichero.getPath(); tempNombreMultimedia[identificador] = fichero.getName(); label.setText(tempNombreMultimedia[identificador]); if (label.getText().length() > 10) label.setText(tempNombreMultimedia[identificador].substring(0, 10) + "...mp3"); } catch (Exception ex) { JOptionPane.showMessageDialog(null, "Error abriendo la imagen" + ex); } } }
From source file:com.diversityarrays.kdxplore.curate.SampleEntryPanel.java
SampleEntryPanel(CurationData cd, IntFunction<Trait> traitProvider, TypedSampleMeasurementTableModel tsm, JTable table, TsmCellRenderer tsmCellRenderer, JToggleButton showPpiOption, Closure<Void> refreshFieldLayoutView, BiConsumer<Comparable<?>, List<CurationCellValue>> showChangedValue, SampleType[] sampleTypes) { this.curationData = cd; this.traitProvider = traitProvider; this.typedSampleTableModel = tsm; this.typedSampleTable = table; this.showPpiOption = showPpiOption; this.initialTableRowHeight = typedSampleTable.getRowHeight(); this.tsmCellRenderer = tsmCellRenderer; this.refreshFieldLayoutView = refreshFieldLayoutView; this.showChangedValue = showChangedValue; List<SampleType> list = new ArrayList<>(); list.add(NO_SAMPLE_TYPE);//ww w. j av a 2s .com for (SampleType st : sampleTypes) { list.add(st); sampleTypeById.put(st.getTypeId(), st); } sampleTypeCombo = new JComboBox<SampleType>(list.toArray(new SampleType[list.size()])); typedSampleTableModel.addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent e) { if (TableModelEvent.HEADER_ROW == e.getFirstRow()) { typedSampleTable.setAutoCreateColumnsFromModel(true); everSetData = false; } } }); showStatsAction.putValue(Action.SHORT_DESCRIPTION, Vocab.TOOLTIP_STATS_FOR_KDSMART_SAMPLES()); showStatsOption.setFont(showStatsOption.getFont().deriveFont(Font.BOLD)); showStatsOption.setPreferredSize(new Dimension(30, 30)); JLabel helpPanel = new JLabel(); helpPanel.setHorizontalAlignment(JLabel.CENTER); String html = "<HTML>Either enter a value or select<br>a <i>Source</i> for <b>Value From:</b>"; if (shouldShowSampleType(sampleTypes)) { html += "<BR>You may also select a <i>Sample Type</i> if it is relevant."; } helpPanel.setText(html); singleOrMultiCardPanel.add(helpPanel, CARD_SINGLE); singleOrMultiCardPanel.add(applyToPanel, CARD_MULTI); // singleOrMultiCardPanel.add(multiCellControlsPanel, CARD_MULTI); validationMessage.setBorder(new LineBorder(Color.LIGHT_GRAY)); validationMessage.setForeground(Color.RED); validationMessage.setBackground(new JLabel().getBackground()); validationMessage.setHorizontalAlignment(SwingConstants.CENTER); // validationMessage.setEditable(false); Box setButtons = Box.createHorizontalBox(); setButtons.add(new JButton(deleteAction)); setButtons.add(new JButton(notApplicableAction)); setButtons.add(new JButton(missingAction)); setButtons.add(new JButton(setValueAction)); deleteAction.putValue(Action.SHORT_DESCRIPTION, Vocab.TOOLTIP_SET_UNSET()); notApplicableAction.putValue(Action.SHORT_DESCRIPTION, Vocab.TOOLTIP_SET_NA()); missingAction.putValue(Action.SHORT_DESCRIPTION, Vocab.TOOLTIP_SET_MISSING()); setValueAction.putValue(Action.SHORT_DESCRIPTION, Vocab.TOOLTIP_SET_VALUE()); Box sampleType = Box.createHorizontalBox(); sampleType.add(new JLabel(Vocab.LABEL_SAMPLE_TYPE())); sampleType.add(sampleTypeCombo); statisticsControls = generateStatControls(); setBorder(new TitledBorder(new LineBorder(Color.GREEN.darker().darker()), "Sample Entry Panel")); GBH gbh = new GBH(this); int y = 0; gbh.add(0, y, 2, 1, GBH.HORZ, 1, 1, GBH.CENTER, statisticsControls); ++y; if (shouldShowSampleType(sampleTypes)) { sampleType.setBorder(new LineBorder(Color.RED)); sampleType.setToolTipText("DEVELOPER MODE: sampleType is possible hack for accept/suppress"); gbh.add(0, y, 2, 1, GBH.HORZ, 1, 1, GBH.CENTER, sampleType); ++y; } sampleSourceControls = Box.createHorizontalBox(); sampleSourceControls.add(new JLabel(Vocab.PROMPT_VALUES_FROM())); // sampleSourceControls.add(new JSeparator(JSeparator.VERTICAL)); sampleSourceControls.add(sampleSourceComboBox); sampleSourceControls.add(Box.createHorizontalGlue()); sampleSourceComboBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updateSetValueAction(); } }); gbh.add(0, y, 2, 1, GBH.HORZ, 1, 1, GBH.CENTER, sampleSourceControls); ++y; gbh.add(0, y, 2, 1, GBH.HORZ, 1, 1, GBH.CENTER, valueDescription); ++y; gbh.add(0, y, 1, 1, GBH.NONE, 1, 1, GBH.WEST, showStatsOption); gbh.add(1, y, 1, 1, GBH.HORZ, 2, 1, GBH.CENTER, sampleValueTextField); ++y; gbh.add(0, y, 2, 1, GBH.NONE, 1, 1, GBH.CENTER, setButtons); ++y; gbh.add(0, y, 2, 1, GBH.HORZ, 2, 1, GBH.CENTER, validationMessage); ++y; gbh.add(0, y, 2, 1, GBH.HORZ, 2, 0, GBH.CENTER, singleOrMultiCardPanel); ++y; deleteAction.setEnabled(false); sampleSourceControls.setVisible(false); sampleValueTextField.setGrayWhenDisabled(true); sampleValueTextField.addActionListener(enterKeyListener); sampleValueTextField.getDocument().addDocumentListener(new DocumentListener() { @Override public void removeUpdate(DocumentEvent e) { updateSetValueAction(); } @Override public void insertUpdate(DocumentEvent e) { updateSetValueAction(); } @Override public void changedUpdate(DocumentEvent e) { updateSetValueAction(); } }); setValueAction.setEnabled(false); }
From source file:edu.harvard.i2b2.query.ui.MainPanel.java
public void addPanel() { int rightmostPosition = dataModel.lastLabelPosition(); JLabel label = new JLabel(); label.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); label.setText("and"); label.setToolTipText("Click to change the relationship"); label.setBorder(javax.swing.BorderFactory.createEtchedBorder()); label.addMouseListener(new java.awt.event.MouseAdapter() { @Override//from w w w . ja va2s. c o m public void mouseClicked(java.awt.event.MouseEvent evt) { jAndOrLabelMouseClicked(evt); } }); // jPanel1.add(label); // label.setBounds(rightmostPosition, 90, 30, 18); GroupPanel panel = new GroupPanel("Group " + (dataModel.getCurrentPanelCount() + 1), this); jPanel1.add(panel); panel.setBounds(rightmostPosition + 5, 0, 180, getParent().getHeight() - 100); jPanel1.setPreferredSize(new Dimension(rightmostPosition + 5 + 181 + 60, getHeight() - 100)); jScrollPane4.setViewportView(jPanel1); dataModel.addPanel(panel, label, rightmostPosition + 5 + 180); jScrollPane4.getHorizontalScrollBar().setValue(jScrollPane4.getHorizontalScrollBar().getMaximum()); jScrollPane4.getHorizontalScrollBar().setUnitIncrement(40); resizePanels(getParent().getWidth(), getParent().getHeight()); }
From source file:edu.harvard.i2b2.query.ui.MainPanel.java
private void jMorePanelsButtonActionPerformed(java.awt.event.ActionEvent evt) { if (dataModel.hasEmptyPanels()) { JOptionPane.showMessageDialog(this, "Please use an existing empty panel before adding a new one."); return;//from w ww . j av a 2s . c o m } int rightmostPosition = dataModel.lastLabelPosition(); JLabel label = new JLabel(); label.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); label.setText("and"); label.setToolTipText("Click to change the relationship"); label.setBorder(javax.swing.BorderFactory.createEtchedBorder()); label.addMouseListener(new java.awt.event.MouseAdapter() { @Override public void mouseClicked(java.awt.event.MouseEvent evt) { jAndOrLabelMouseClicked(evt); } }); GroupPanel panel = new GroupPanel("Group " + (dataModel.getCurrentPanelCount() + 1), this); jPanel1.add(panel); panel.setBounds(rightmostPosition + 5, 0, 180, getParent().getHeight() - 100); jPanel1.setPreferredSize(new Dimension(rightmostPosition + 5 + 181 + 60, getHeight() - 100)); jScrollPane4.setViewportView(jPanel1); dataModel.addPanel(panel, label, rightmostPosition + 5 + 180); /* * System.out.println(jScrollPane4.getViewport().getExtentSize().width+":" * + jScrollPane4.getViewport().getExtentSize().height); * System.out.println * (jScrollPane4.getHorizontalScrollBar().getVisibleRect().width+":" * +jScrollPane4.getHorizontalScrollBar().getVisibleRect().height); * System * .out.println(jScrollPane4.getHorizontalScrollBar().getVisibleAmount * ()); * System.out.println(jScrollPane4.getHorizontalScrollBar().getValue()); */ jScrollPane4.getHorizontalScrollBar().setValue(jScrollPane4.getHorizontalScrollBar().getMaximum()); jScrollPane4.getHorizontalScrollBar().setUnitIncrement(40); // this.jScrollPane4.removeAll(); // this.jScrollPane4.setViewportView(jPanel1); // revalidate(); // jScrollPane3.setBounds(420, 0, 170, 300); // jScrollPane4.setBounds(20, 35, 335, 220); resizePanels(getParent().getWidth(), getParent().getHeight()); }
From source file:edu.ku.brc.specify.plugins.PartialDateUI.java
@Override public void setParent(final FormViewObj parent) { this.parent = parent; JLabel lbl = parent.getLabelFor(this); if (lbl != null && StringUtils.isNotEmpty(dateFieldName)) { DBTableInfo tblInfo = DBTableIdMgr.getInstance().getByClassName(parent.getView().getClassName()); if (tblInfo != null) { final DBFieldInfo fi = tblInfo.getFieldByName(dateFieldName); if (fi != null) { title = fi.getTitle();/*from w ww .java2s . co m*/ isRequired = fi.isRequired(); if (uivs[0] instanceof ValFormattedTextFieldSingle) { ((ValFormattedTextFieldSingle) uivs[0]).setRequired(isRequired); } else { for (UIValidatable uiv : uivs) { ((ValFormattedTextField) uiv).setRequired(isRequired); } } if (StringUtils.isNotEmpty(fi.getTitle())) { lbl.setText(fi.getTitle() + ":"); if (isRequired) { lbl.setFont(lbl.getFont().deriveFont(Font.BOLD)); } } if (lbl != null) { lbl.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { super.mouseClicked(e); if (e.getClickCount() == 2) { JOptionPane.showMessageDialog(UIRegistry.getMostRecentWindow(), "<html>" + fi.getDescription(), UIRegistry.getResourceString("FormViewObj.UNOTES"), JOptionPane.INFORMATION_MESSAGE); } } }); } } else { log.error("PartialDateUI - Couldn't find date field [" + dateFieldName + "] in data obj View: " + parent.getView().getName()); } } } }
From source file:org.gdms.usm.view.ProgressFrame.java
public ProgressFrame(Step s, boolean modifyThresholds) { super("Progress"); simulation = s;//from ww w . j a v a2 s . c o m s.registerStepListener(this); stepSeconds = new LinkedList<Integer>(); s.getManager().setModifyThresholds(modifyThresholds); s.getManager().setAdvisor(this); JPanel statusPanel = new JPanel(new BorderLayout()); JPanel globalPanel = new JPanel(new SpringLayout()); //Time elapsed panel JPanel timePanel = new JPanel(new BorderLayout(5, 5)); final JLabel timeLabel = new JLabel("00:00:00", SwingConstants.CENTER); timeLabel.setFont(new Font("Serif", Font.BOLD, 45)); timePanel.add(timeLabel, BorderLayout.SOUTH); JLabel elapsed = new JLabel("Time Elapsed :", SwingConstants.CENTER); timePanel.add(elapsed, BorderLayout.NORTH); statusPanel.add(timePanel, BorderLayout.NORTH); ActionListener timerListener = new ActionListener() { public void actionPerformed(ActionEvent e) { totalSeconds++; int hours = totalSeconds / 3600; String hourss; if (hours < 10) { hourss = "0" + hours; } else { hourss = "" + hours; } int minutes = (totalSeconds % 3600) / 60; String minutess; if (minutes < 10) { minutess = "0" + minutes; } else { minutess = "" + minutes; } int seconds = totalSeconds % 60; String secondss; if (seconds < 10) { secondss = "0" + seconds; } else { secondss = seconds + ""; } timeLabel.setText(hourss + ":" + minutess + ":" + secondss); } }; timer = new Timer(1000, timerListener); timer.start(); //Turn progress panel JPanel turnPanel = new JPanel(new BorderLayout(5, 5)); JLabel turnLabel = new JLabel("Current Step :", SwingConstants.CENTER); turnPanel.add(turnLabel, BorderLayout.NORTH); currentTurn = new JLabel("Init", SwingConstants.CENTER); currentTurn.setFont(new Font("Serif", Font.BOLD, 30)); turnPanel.add(currentTurn, BorderLayout.SOUTH); globalPanel.add(turnPanel); //Movers panel JPanel moversPanel = new JPanel(new BorderLayout(5, 5)); JLabel moversLabel = new JLabel("Last movers count :", SwingConstants.CENTER); moversPanel.add(moversLabel, BorderLayout.NORTH); lastMoversCount = new JLabel("Init", SwingConstants.CENTER); lastMoversCount.setFont(new Font("Serif", Font.BOLD, 30)); moversPanel.add(lastMoversCount, BorderLayout.SOUTH); globalPanel.add(moversPanel); //Initial population panel JPanel initPopPanel = new JPanel(new BorderLayout(5, 5)); JLabel initialPopulationLabel = new JLabel("Initial population :", SwingConstants.CENTER); initPopPanel.add(initialPopulationLabel, BorderLayout.NORTH); initialPopulationCount = new JLabel("Init", SwingConstants.CENTER); initialPopulationCount.setFont(new Font("Serif", Font.BOLD, 30)); initPopPanel.add(initialPopulationCount, BorderLayout.SOUTH); globalPanel.add(initPopPanel); //Current population panel JPanel curPopPanel = new JPanel(new BorderLayout(5, 5)); JLabel currentPopulationLabel = new JLabel("Current population :", SwingConstants.CENTER); curPopPanel.add(currentPopulationLabel, BorderLayout.NORTH); currentPopulation = new JLabel("Init", SwingConstants.CENTER); currentPopulation.setFont(new Font("Serif", Font.BOLD, 30)); curPopPanel.add(currentPopulation, BorderLayout.SOUTH); globalPanel.add(curPopPanel); //Dead panel JPanel deadPanel = new JPanel(new BorderLayout(5, 5)); JLabel deadLabel = new JLabel("Last death toll :", SwingConstants.CENTER); deadPanel.add(deadLabel, BorderLayout.NORTH); lastDeathToll = new JLabel("Init", SwingConstants.CENTER); lastDeathToll.setFont(new Font("Serif", Font.BOLD, 30)); deadPanel.add(lastDeathToll, BorderLayout.SOUTH); globalPanel.add(deadPanel); //Newborn panel JPanel newbornPanel = new JPanel(new BorderLayout(5, 5)); JLabel newbornLabel = new JLabel("Last newborn count :", SwingConstants.CENTER); newbornPanel.add(newbornLabel, BorderLayout.NORTH); lastNewbornCount = new JLabel("Init", SwingConstants.CENTER); lastNewbornCount.setFont(new Font("Serif", Font.BOLD, 30)); newbornPanel.add(lastNewbornCount, BorderLayout.SOUTH); globalPanel.add(newbornPanel); SpringUtilities.makeCompactGrid(globalPanel, 3, 2, 5, 5, 20, 10); statusPanel.add(globalPanel, BorderLayout.SOUTH); add(statusPanel, BorderLayout.WEST); //Graph tabbed pane JTabbedPane tabbedPane = new JTabbedPane(); timeChart = new XYSeries("Step time", true, false); tabbedPane.addTab("Step time", createChartPanel("Step time", timeChart)); currentPopulationChart = new XYSeries("Population", true, false); tabbedPane.addTab("Population", createChartPanel("Population", currentPopulationChart)); deathTollChart = new XYSeries("Deaths", true, false); tabbedPane.addTab("Deaths", createChartPanel("Deaths", deathTollChart)); newbornCountChart = new XYSeries("Newborn", true, false); tabbedPane.addTab("Newborn", createChartPanel("Newborn", newbornCountChart)); moversCountChart = new XYSeries("Movers", true, false); tabbedPane.addTab("Movers", createChartPanel("Movers", moversCountChart)); add(tabbedPane, BorderLayout.EAST); getRootPane().setBorder(BorderFactory.createEmptyBorder(10, 20, 10, 10)); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); pack(); setLocationRelativeTo(null); setVisible(true); }
From source file:at.becast.youploader.gui.FrmMain.java
public void initMainTab() { cmbCategory = new JComboBox<Categories>(); cmbCategory.setModel(new DefaultComboBoxModel<Categories>(Categories.values())); SideBar sideBar = new SideBar(SideBar.SideBarMode.TOP_LEVEL, true, 300, true); ss1 = new SidebarSection(sideBar, LANG.getString("frmMain.Sidebar.Settings"), new EditPanel(this), new ImageIcon(getClass().getResource("/pencil.png"))); ss2 = new SidebarSection(sideBar, LANG.getString("frmMain.Sidebar.Playlists"), new PlaylistPanel(this), new ImageIcon(getClass().getResource("/layers.png"))); ss3 = new SidebarSection(sideBar, LANG.getString("frmMain.Sidebar.Monetisation"), new MonetPanel(), new ImageIcon(getClass().getResource("/money.png"))); sideBar.addSection(ss1, false);/*from w w w. j a v a 2 s . c o m*/ sideBar.addSection(ss2); sideBar.addSection(ss3); JPanel mainTab = new JPanel(); JPanel panel = new JPanel(); GroupLayout mainTabLayout = new GroupLayout(mainTab); mainTabLayout.setHorizontalGroup(mainTabLayout.createParallelGroup(Alignment.TRAILING) .addGroup(mainTabLayout.createSequentialGroup() .addComponent(panel, GroupLayout.DEFAULT_SIZE, 465, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(sideBar, GroupLayout.DEFAULT_SIZE, 408, Short.MAX_VALUE))); mainTabLayout.setVerticalGroup(mainTabLayout.createParallelGroup(Alignment.LEADING) .addComponent(panel, GroupLayout.DEFAULT_SIZE, 492, Short.MAX_VALUE) .addGroup(mainTabLayout.createSequentialGroup() .addComponent(sideBar, GroupLayout.DEFAULT_SIZE, 469, Short.MAX_VALUE).addContainerGap())); panel.setLayout(new FormLayout( new ColumnSpec[] { ColumnSpec.decode("2px"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("20px:grow"), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("23px"), ColumnSpec.decode("33px"), FormSpecs.UNRELATED_GAP_COLSPEC, ColumnSpec.decode("61px"), FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("24px"), ColumnSpec.decode("28px"), ColumnSpec.decode("40px"), ColumnSpec.decode("36px"), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("28px"), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("58px"), }, new RowSpec[] { RowSpec.decode("2px"), FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("14px"), RowSpec.decode("25px"), FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("14px"), RowSpec.decode("25px"), FormSpecs.LINE_GAP_ROWSPEC, RowSpec.decode("14px"), RowSpec.decode("25px"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, RowSpec.decode("64dlu:grow"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, RowSpec.decode("max(64dlu;default)"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, RowSpec.decode("25px"), FormSpecs.PARAGRAPH_GAP_ROWSPEC, RowSpec.decode("24px"), RowSpec.decode("23px"), })); lbltitlelenght = new JLabel("(0/100)"); panel.add(lbltitlelenght, "14, 6, 3, 1, right, top"); txtTitle = new JTextField(); contextMenu.add(txtTitle); panel.add(txtTitle, "3, 7, 14, 1, fill, fill"); txtTitle.setColumns(10); txtTitle.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { calcNotifies(); } }); JLabel lblCategory = new JLabel(LANG.getString("frmMain.Category")); panel.add(lblCategory, "3, 9, 4, 1, left, bottom"); panel.add(cmbCategory, "3, 10, 14, 1, fill, fill"); JLabel lblDescription = new JLabel(LANG.getString("frmMain.Description")); panel.add(lblDescription, "3, 12, 4, 1, left, bottom"); lblDesclenght = new JLabel("(0/5000)"); panel.add(lblDesclenght, "14, 12, 3, 1, right, bottom"); JScrollPane DescriptionScrollPane = new JScrollPane(); panel.add(DescriptionScrollPane, "3, 13, 14, 1, fill, fill"); txtDescription = new JTextArea(); contextMenu.add(txtDescription); txtDescription.setFont(new Font("SansSerif", Font.PLAIN, 13)); DescriptionScrollPane.setViewportView(txtDescription); txtDescription.setWrapStyleWord(true); txtDescription.setLineWrap(true); txtDescription.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { calcNotifies(); } }); JLabel lblTags = new JLabel(LANG.getString("frmMain.Tags")); panel.add(lblTags, "3, 15, 4, 1, left, bottom"); lblTagslenght = new JLabel("(0/500)"); panel.add(lblTagslenght, "14, 15, 3, 1, right, top"); JScrollPane TagScrollPane = new JScrollPane(); panel.add(TagScrollPane, "3, 16, 14, 1, fill, fill"); txtTags = new JTextArea(); contextMenu.add(txtTags); txtTags.setFont(new Font("SansSerif", Font.PLAIN, 13)); TagScrollPane.setViewportView(txtTags); txtTags.setWrapStyleWord(true); txtTags.setLineWrap(true); txtTags.setBorder(BorderFactory.createEtchedBorder()); txtTags.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { calcNotifies(); } }); JLabel lblAccount = new JLabel(LANG.getString("frmMain.Account")); panel.add(lblAccount, "3, 18, 4, 1, left, bottom"); cmbAccount = new JComboBox<AccountType>(); panel.add(getCmbAccount(), "3, 19, 14, 1, fill, fill"); cmbAccount.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { changeUser(); } }); btnAddToQueue = new JButton(LANG.getString("frmMain.addtoQueue")); btnAddToQueue.setEnabled(false); panel.add(btnAddToQueue, "3, 21, 6, 1, fill, fill"); btnAddToQueue.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { queueButton(); } }); JLabel lblSelectVideo = new JLabel(); panel.add(lblSelectVideo, "3, 3, 4, 1, left, bottom"); lblSelectVideo.setText(LANG.getString("frmMain.selectVideoFile")); cmbFile = new JComboBox<String>(); cmbFile.setDropTarget(new DropTarget() { private static final long serialVersionUID = 8809983794742040683L; public synchronized void drop(DropTargetDropEvent evt) { try { evt.acceptDrop(DnDConstants.ACTION_COPY); @SuppressWarnings("unchecked") List<File> droppedFiles = (List<File>) evt.getTransferable() .getTransferData(DataFlavor.javaFileListFlavor); for (File file : droppedFiles) { cmbFile.removeAllItems(); cmbFile.addItem(file.getAbsolutePath()); } } catch (Exception ex) { LOG.error("Error dropping video file", ex); } } }); panel.add(cmbFile, "3, 4, 14, 1, fill, fill"); JButton btnSelectMovie = new JButton(); btnSelectMovie.setToolTipText("Select Video File"); panel.add(btnSelectMovie, "18, 4, center, top"); btnSelectMovie.setIcon(new ImageIcon(getClass().getResource("/film_add.png"))); JLabel lblTitle = new JLabel(LANG.getString("frmMain.Title")); panel.add(lblTitle, "3, 6, 4, 1, left, bottom"); JButton btnReset = new JButton(LANG.getString("frmMain.Reset")); btnReset.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { resetEdit(); } }); panel.add(btnReset, "11, 21, 6, 1, fill, fill"); btnSelectMovie.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { EditPanel edit = (EditPanel) ss1.contentPane; NativeJFileChooser chooser; if (edit.getTxtStartDir() != null && !edit.getTxtStartDir().equals("")) { chooser = new NativeJFileChooser(edit.getTxtStartDir().getText().trim()); } else { chooser = new NativeJFileChooser(); } int returnVal = chooser.showOpenDialog((Component) self); if (returnVal == JFileChooser.APPROVE_OPTION) { cmbFile.removeAllItems(); cmbFile.addItem(chooser.getSelectedFile().getAbsolutePath().toString()); } } }); mainTab.setLayout(mainTabLayout); mainTab.revalidate(); mainTab.repaint(); TabbedPane.addTab(LANG.getString("frmMain.Tabs.VideoSettings"), mainTab); }