List of usage examples for javax.swing JPopupMenu JPopupMenu
public JPopupMenu(String label)
JPopupMenu
with the specified title. From source file:it.unibas.spicygui.controllo.provider.composition.MyPopupProviderWidgetChainComposition.java
private void createPopupMenu() { menu = new JPopupMenu("Popup menu"); JMenuItem itemDeleteWidget;// ww w . ja v a2 s. c o m itemDeleteWidget = new JMenuItem(NbBundle.getMessage(Costanti.class, Costanti.DELETE_WIDGET_COMPOSITION)); itemDeleteWidget.setActionCommand(DELETE); itemDeleteWidget.addActionListener(this); menu.add(itemDeleteWidget); itemLoadDataSource = new JMenuItem(NbBundle.getMessage(Costanti.class, Costanti.LOAD_DATASOURCE_FOR_CHAIN)); itemLoadDataSource.setActionCommand(LOAD); itemLoadDataSource.addActionListener(this); menu.add(itemLoadDataSource); }
From source file:lu.lippmann.cdb.ext.hydviga.ui.GapsUIUtil.java
private static void addExportPopupMenu(final Instances ds, final ChartPanel cp) { cp.addChartMouseListener(new ChartMouseListener() { public void chartMouseClicked(ChartMouseEvent e) { final JPopupMenu jPopupMenu = new JPopupMenu("feur"); final JMenuItem mi1 = new JMenuItem("Export as CSV"); mi1.addActionListener(new ActionListener() { @Override/*w ww . j a va 2 s . com*/ public void actionPerformed(final ActionEvent e) { final JFileChooser fc = new JFileChooser(); fc.setAcceptAllFileFilterUsed(false); final int returnVal = fc.showSaveDialog(cp); if (returnVal == JFileChooser.APPROVE_OPTION) { try { final File file = fc.getSelectedFile(); WekaDataAccessUtil.saveInstancesIntoCSVFile(ds, file); } catch (final Exception ee) { ee.printStackTrace(); } } } }); jPopupMenu.add(mi1); jPopupMenu.show(cp, e.getTrigger().getX(), e.getTrigger().getY()); } public void chartMouseMoved(ChartMouseEvent e) { } }); }
From source file:lu.lippmann.cdb.ext.hydviga.ui.GapsOverviewPanel.java
public void refresh(final Instances dataSet, final int dateIdx) { final Instances gapsDescriptionsDataset = GapsUtil.buildGapsDescription(gcp, dataSet, dateIdx); final JXTable gapsDescriptionsTable = new JXTable(); final InstanceTableModel gapsDescriptionsTableModel = new InstanceTableModel(false); gapsDescriptionsTableModel.setDataset(gapsDescriptionsDataset); gapsDescriptionsTable.setModel(gapsDescriptionsTableModel); gapsDescriptionsTable.setEditable(true); gapsDescriptionsTable.setShowHorizontalLines(false); gapsDescriptionsTable.setShowVerticalLines(false); gapsDescriptionsTable.setVisibleRowCount(5); gapsDescriptionsTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); gapsDescriptionsTable.setSortable(false); gapsDescriptionsTable.packAll();// ww w .j a v a 2s .co m gapsDescriptionsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); gapsDescriptionsTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { int modelRow = gapsDescriptionsTable.getSelectedRow(); if (modelRow < 0) modelRow = 0; final String attrname = gapsDescriptionsTableModel.getValueAt(modelRow, 1).toString(); final Attribute attr = dataSet.attribute(attrname); final int gapsize = (int) Double .valueOf(gapsDescriptionsTableModel.getValueAt(modelRow, 5).toString()).doubleValue(); final int position = (int) Double .valueOf(gapsDescriptionsTableModel.getValueAt(modelRow, 6).toString()).doubleValue(); try { final ChartPanel cp = GapsUIUtil.buildGapChartPanel(dataSet, dateIdx, attr, gapsize, position); visualOverviewPanel.removeAll(); visualOverviewPanel.add(cp, BorderLayout.CENTER); geomapPanel.removeAll(); geomapPanel.add(gcp.getMapPanel(Arrays.asList(attrname), new ArrayList<String>(), false)); jxp.updateUI(); } catch (Exception ee) { ee.printStackTrace(); } } } }); gapsDescriptionsTable.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(final MouseEvent e) { final InstanceTableModel instanceTableModel = (InstanceTableModel) gapsDescriptionsTable.getModel(); final int row = gapsDescriptionsTable.rowAtPoint(e.getPoint()); //final int row=gapsDescriptionsTable.getSelectedRow(); final int modelRow = gapsDescriptionsTable.convertRowIndexToModel(row); //final int modelRow=(int)Double.valueOf(instanceTableModel.getValueAt(row,0).toString()).doubleValue(); //System.out.println(row+" "+modelRow); final String attrname = instanceTableModel.getValueAt(modelRow, 1).toString(); final Attribute attr = dataSet.attribute(attrname); final int gapsize = (int) Double.valueOf(instanceTableModel.getValueAt(modelRow, 5).toString()) .doubleValue(); final int position = (int) Double.valueOf(instanceTableModel.getValueAt(modelRow, 6).toString()) .doubleValue(); if (!e.isPopupTrigger()) { // nothing? } else { final JPopupMenu jPopupMenu = new JPopupMenu("feur"); final JMenuItem interactiveFillMenuItem = new JMenuItem("Fill this gap (interactively)"); interactiveFillMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final GapFillingFrame jxf = new GapFillingFrame(atv, dataSet, attr, dateIdx, GapsUtil.getCountOfValuesBeforeAndAfter(gapsize), position, gapsize, gcp, false); jxf.setSize(new Dimension(900, 700)); //jxf.setExtendedState(Frame.MAXIMIZED_BOTH); jxf.setLocationRelativeTo(jPopupMenu); jxf.setVisible(true); //jxf.setResizable(false); } }); jPopupMenu.add(interactiveFillMenuItem); final JMenuItem lookupInKnowledgeDBMenuItem = new JMenuItem( "Show the most similar cases from KnowledgeDB"); lookupInKnowledgeDBMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final double x = gcp.getCoordinates(attrname)[0]; final double y = gcp.getCoordinates(attrname)[1]; final String season = instanceTableModel.getValueAt(modelRow, 3).toString() .split("/")[0]; final boolean isDuringRising = instanceTableModel.getValueAt(modelRow, 11).toString() .equals("true"); try { final Calendar cal = Calendar.getInstance(); final String dateAsString = instanceTableModel.getValueAt(modelRow, 2).toString() .replaceAll("'", ""); cal.setTime(FormatterUtil.DATE_FORMAT.parse(dateAsString)); final int year = cal.get(Calendar.YEAR); new SimilarCasesFrame(dataSet, dateIdx, gcp, attrname, gapsize, position, x, y, year, season, isDuringRising); } catch (Exception e1) { e1.printStackTrace(); } } }); jPopupMenu.add(lookupInKnowledgeDBMenuItem); final JMenuItem mExport = new JMenuItem("Export this table as CSV"); mExport.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final JFileChooser fc = new JFileChooser(); fc.setAcceptAllFileFilterUsed(false); final int returnVal = fc.showSaveDialog(gapsDescriptionsTable); if (returnVal == JFileChooser.APPROVE_OPTION) { try { final File file = fc.getSelectedFile(); WekaDataAccessUtil.saveInstancesIntoCSVFile(gapsDescriptionsDataset, file); } catch (Exception ee) { ee.printStackTrace(); } } } }); jPopupMenu.add(mExport); jPopupMenu.show(gapsDescriptionsTable, e.getX(), e.getY()); } } }); final int tableWidth = (int) gapsDescriptionsTable.getPreferredSize().getWidth() + 30; final JScrollPane scrollPane = new JScrollPane(gapsDescriptionsTable); scrollPane.setPreferredSize(new Dimension(Math.min(tableWidth, 500), 500)); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); this.tablePanel.removeAll(); this.tablePanel.add(scrollPane, BorderLayout.CENTER); this.visualOverviewPanel.removeAll(); /* automatically compute the most similar series and the 'rising' flag */ new AbstractSimpleAsync<Void>(false) { @Override public Void execute() throws Exception { final int rc = gapsDescriptionsTableModel.getRowCount(); for (int i = 0; i < rc; i++) { final int modelRow = i; try { final String attrname = gapsDescriptionsTableModel.getValueAt(modelRow, 1).toString(); final Attribute attr = dataSet.attribute(attrname); final int gapsize = (int) Double .valueOf(gapsDescriptionsTableModel.getValueAt(modelRow, 5).toString()) .doubleValue(); final int position = (int) Double .valueOf(gapsDescriptionsTableModel.getValueAt(modelRow, 6).toString()) .doubleValue(); /* most similar */ gapsDescriptionsTableModel.setValueAt("...", modelRow, 7); final int cvba = GapsUtil.getCountOfValuesBeforeAndAfter(gapsize); Instances gapds = WekaDataProcessingUtil.buildFilteredDataSet(dataSet, 0, dataSet.numAttributes() - 1, Math.max(0, position - cvba), Math.min(position + gapsize + cvba, dataSet.numInstances() - 1)); final String mostsimilar = WekaTimeSeriesSimilarityUtil.findMostSimilarTimeSerie(gapds, attr, WekaTimeSeriesUtil.getNamesOfAttributesWithoutGap(gapds), false); gapsDescriptionsTableModel.setValueAt(mostsimilar, modelRow, 7); /* 'rising' flag */ gapsDescriptionsTableModel.setValueAt("...", modelRow, 11); final List<String> attributeNames = WekaDataStatsUtil.getAttributeNames(dataSet); attributeNames.remove("timestamp"); final String nearestStationName = gcp.findNearestStation(attr.name(), attributeNames); final Attribute nearestStationAttr = dataSet.attribute(nearestStationName); //System.out.println(nearestStationName+" "+nearestStationAttr); final boolean isDuringRising = GapsUtil.isDuringRising(dataSet, position, gapsize, new int[] { dateIdx, attr.index(), nearestStationAttr.index() }); gapsDescriptionsTableModel.setValueAt(isDuringRising, modelRow, 11); gapsDescriptionsTableModel.fireTableDataChanged(); } catch (Exception e) { gapsDescriptionsTableModel.setValueAt("n/a", modelRow, 7); gapsDescriptionsTableModel.setValueAt("n/a", modelRow, 11); e.printStackTrace(); } } return null; } @Override public void onSuccess(Void result) { } @Override public void onFailure(Throwable caught) { caught.printStackTrace(); } }.start(); /* select the first row */ gapsDescriptionsTable.setRowSelectionInterval(0, 0); }
From source file:lu.lippmann.cdb.ext.hydviga.ui.SimilarCasesFrame.java
/** * Constructor.// w w w . ja v a 2 s. com */ SimilarCasesFrame(final Instances ds, final int dateIdx, final StationsDataProvider gcp, String attrname, final int gapsize, final int position, final double x, final double y, final int year, final String season, final boolean isDuringRising) throws Exception { LogoHelper.setLogo(this); this.setTitle("KnowledgeDB: Suggested configurations / similar cases"); this.inputCaseTablePanel = new JXPanel(); this.inputCaseTablePanel.setBorder(new TitledBorder("Present case")); this.inputCaseChartPanel = new JXPanel(); this.inputCaseChartPanel.setBorder(new TitledBorder("Profile of the present case")); this.outputCasesTablePanel = new JXPanel(); this.outputCasesTablePanel.setBorder(new TitledBorder("Suggested cases")); this.outputCasesChartPanel = new JXPanel(); this.outputCasesChartPanel.setBorder(new TitledBorder("Profile of the selected suggested case")); getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.PAGE_AXIS)); getContentPane().add(inputCaseTablePanel); getContentPane().add(inputCaseChartPanel); getContentPane().add(outputCasesTablePanel); getContentPane().add(outputCasesChartPanel); final Instances res = GapFillingKnowledgeDB.findSimilarCases(attrname, x, y, year, season, gapsize, position, isDuringRising, gcp.findDownstreamStation(attrname) != null, gcp.findUpstreamStation(attrname) != null, GapsUtil.measureHighMiddleLowInterval(ds, ds.attribute(attrname).index(), position - 1)); final Instances inputCase = new Instances(res); while (inputCase.numInstances() > 1) inputCase.remove(1); final JXTable inputCaseTable = buidJXTable(inputCase); final JScrollPane inputScrollPane = new JScrollPane(inputCaseTable); //System.out.println(inputScrollPane.getPreferredSize()); inputScrollPane.setPreferredSize( new Dimension(COMPONENT_WIDTH, (int) (50 + inputScrollPane.getPreferredSize().getHeight()))); this.inputCaseTablePanel.add(inputScrollPane); final ChartPanel inputcp = GapsUIUtil.buildGapChartPanel(ds, dateIdx, ds.attribute(attrname), gapsize, position); inputcp.getChart().removeLegend(); inputcp.setPreferredSize(CHART_DIMENSION); this.inputCaseChartPanel.add(inputcp); final Instances outputCases = new Instances(res); outputCases.remove(0); final JXTable outputCasesTable = buidJXTable(outputCases); final JScrollPane outputScrollPane = new JScrollPane(outputCasesTable); outputScrollPane.setPreferredSize( new Dimension(COMPONENT_WIDTH, (int) (50 + outputScrollPane.getPreferredSize().getHeight()))); this.outputCasesTablePanel.add(outputScrollPane); outputCasesTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); outputCasesTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { final int modelRow = outputCasesTable.getSelectedRow(); final String attrname = outputCasesTable.getModel().getValueAt(modelRow, 1).toString(); final int gapsize = (int) Double .valueOf(outputCasesTable.getModel().getValueAt(modelRow, 4).toString()).doubleValue(); final int position = (int) Double .valueOf(outputCasesTable.getModel().getValueAt(modelRow, 5).toString()).doubleValue(); try { final ChartPanel cp = GapsUIUtil.buildGapChartPanel(ds, dateIdx, ds.attribute(attrname), gapsize, position); cp.getChart().removeLegend(); cp.setPreferredSize(CHART_DIMENSION); outputCasesChartPanel.removeAll(); outputCasesChartPanel.add(cp); getContentPane().repaint(); pack(); } catch (Exception e1) { e1.printStackTrace(); } } } }); outputCasesTable.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(final MouseEvent e) { final InstanceTableModel instanceTableModel = (InstanceTableModel) outputCasesTable.getModel(); final int row = outputCasesTable.rowAtPoint(e.getPoint()); final int modelRow = outputCasesTable.convertRowIndexToModel(row); final String attrname = instanceTableModel.getValueAt(modelRow, 1).toString(); final int gapsize = (int) Double.valueOf(instanceTableModel.getValueAt(modelRow, 4).toString()) .doubleValue(); final int position = (int) Double.valueOf(instanceTableModel.getValueAt(modelRow, 5).toString()) .doubleValue(); if (e.isPopupTrigger()) { final JPopupMenu jPopupMenu = new JPopupMenu("feur"); final JMenuItem mi = new JMenuItem("Use this configuration"); mi.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { System.out.println("not implemented!"); } }); jPopupMenu.add(mi); jPopupMenu.show(outputCasesTable, e.getX(), e.getY()); } else { // nothing? } } }); setPreferredSize(new Dimension(FRAME_WIDTH, 900)); pack(); setVisible(true); /* select the first row */ outputCasesTable.setRowSelectionInterval(0, 0); }
From source file:net.sf.firemox.clickable.target.card.CardFactory.java
/** * All settings defined in the properties file and relating cards are managed * here. Also, initialize the tooltip headers and topics to display fastest * the tooltip of card.// w w w. j a v a 2s.c om */ public static void initSettings() { ttPower = "<br><b>" + LanguageManager.getString("power") + ": </b>"; ttToughness = "<br><b>" + LanguageManager.getString("toughness") + ": </b>"; ttState = "<br><b>" + LanguageManager.getString("states") + ": </b>"; ttDamage = "<br><b>" + LanguageManager.getString("damages") + ": </b>"; ttProperties = "<br><b>" + LanguageManager.getString("properties") + ": </b>"; ttColors = "<br><b>" + LanguageManager.getString("colors") + ": </b>"; ttTypes = "<br><b>" + LanguageManager.getString("types") + ": </b>"; ttHeader = "<html><b>" + LanguageManager.getString("card.name") + ": </b>"; ttHeaderAbility = "<html><b>" + LanguageManager.getString("activatedability") + ": </b><br> "; ttAbility = "<br><br><b>" + LanguageManager.getString("activatedability") + ": </b><font color='#336600'>"; ttAbiltityEnd = "</font>"; ttManacost = "<br><b>" + LanguageManager.getString("manacost") + " :</b>"; ttManapaid = ")<br><b>" + LanguageManager.getString("manapaid") + " :</b>"; ttAdvancedAability = "<br><br><img src='file:///" + MToolKit.getIconPath("warn.gif") + "'><font color='#660000'><b>" + LanguageManager.getString("advanceactivatedability") + ": </b>"; ttAdvancedAabilityEnd = "</font>"; // credits ttRulesAuthor = "<br><br><b>" + LanguageManager.getString("rulesauthor") + ": </b>"; ttSource = "<br><b>" + LanguageManager.getString("source") + ": </b>"; contextMenu = new JPopupMenu(LanguageManager.getString("options")); contextMenu.setFont(MToolKit.defaultFont); countItem = new JMenuItem("", UIHelper.getIcon("count.gif")); countItem.setFont(MToolKit.defaultFont); expandItem = new JMenuItem(LanguageManager.getString(STR_EXPAND), UIHelper.getIcon(STR_EXPAND + IdConst.TYPE_PIC)); expandItem.setToolTipText( "<html>" + MagicUIComponents.HTML_ICON_TIP + LanguageManager.getString("expandTTtip2")); expandItem.setActionCommand(STR_EXPAND); expandItem.addActionListener(SystemCard.instance); expandItem.setFont(MToolKit.defaultFont); gatherItem = new JMenuItem(LanguageManager.getString(STR_GATHER), UIHelper.getIcon(STR_GATHER + IdConst.TYPE_PIC)); gatherItem.setToolTipText( "<html>" + MagicUIComponents.HTML_ICON_TIP + LanguageManager.getString("expandTTtip2")); gatherItem.setActionCommand(STR_GATHER); gatherItem.addActionListener(SystemCard.instance); gatherItem.setFont(MToolKit.defaultFont); javaDebugItem = new JMenuItem(LanguageManager.getString("javadebug"), UIHelper.getIcon("javadebug.gif")); javaDebugItem.addActionListener(SystemCard.instance); databaseCardInfoItem = new JMenuItem(LanguageManager.getString("databasecard"), UIHelper.getIcon("databasecard.gif")); databaseCardInfoItem.addActionListener(SystemCard.instance); reloadPictureItem = new JMenuItem(LanguageManager.getString("card.reload.picture"), UIHelper.getIcon("reload.gif")); reloadPictureItem.addActionListener(SystemCard.instance); updateColor(Configuration.getString("border-color", "auto")); updateScale(); }
From source file:me.mayo.telnetkek.MainPanel.java
public final void setupTablePopup() { this.tblPlayers.addMouseListener(new MouseAdapter() { @Override/*w w w.j av a2 s. c o m*/ public void mouseReleased(final MouseEvent mouseEvent) { final JTable table = MainPanel.this.tblPlayers; final int r = table.rowAtPoint(mouseEvent.getPoint()); if (r >= 0 && r < table.getRowCount()) { table.setRowSelectionInterval(r, r); } else { table.clearSelection(); } final int rowindex = table.getSelectedRow(); if (rowindex < 0) { return; } if ((SwingUtilities.isRightMouseButton(mouseEvent) || mouseEvent.isControlDown()) && mouseEvent.getComponent() instanceof JTable) { final PlayerInfo player = getSelectedPlayer(); if (player != null) { final JPopupMenu popup = new JPopupMenu(player.getName()); final JMenuItem header = new JMenuItem("Apply action to " + player.getName() + ":"); header.setEnabled(false); popup.add(header); popup.addSeparator(); final ActionListener popupAction = (ActionEvent actionEvent) -> { Object _source = actionEvent.getSource(); if (_source instanceof PlayerListPopupItem_Command) { final PlayerListPopupItem_Command source = (PlayerListPopupItem_Command) _source; final String output = source.getCommand().buildOutput(source.getPlayer(), true); MainPanel.this.getConnectionManager().sendDelayedCommand(output, true, 100); } else if (_source instanceof PlayerListPopupItem) { final PlayerListPopupItem source = (PlayerListPopupItem) _source; final PlayerInfo _player = source.getPlayer(); switch (actionEvent.getActionCommand()) { case "Copy IP": { copyToClipboard(_player.getIp()); MainPanel.this.writeToConsole( new ConsoleMessage("Copied IP to clipboard: " + _player.getIp())); break; } case "Copy Name": { copyToClipboard(_player.getName()); MainPanel.this.writeToConsole( new ConsoleMessage("Copied name to clipboard: " + _player.getName())); break; } case "Copy UUID": { copyToClipboard(_player.getUuid()); MainPanel.this.writeToConsole( new ConsoleMessage("Copied UUID to clipboard: " + _player.getUuid())); break; } } } }; TelnetKek.config.getCommands().stream().map( (command) -> new PlayerListPopupItem_Command(command.getName(), player, command)) .map((item) -> { item.addActionListener(popupAction); return item; }).forEach((item) -> { popup.add(item); }); popup.addSeparator(); JMenuItem item; item = new PlayerListPopupItem("Copy Name", player); item.addActionListener(popupAction); popup.add(item); item = new PlayerListPopupItem("Copy IP", player); item.addActionListener(popupAction); popup.add(item); item = new PlayerListPopupItem("Copy UUID", player); item.addActionListener(popupAction); popup.add(item); popup.show(mouseEvent.getComponent(), mouseEvent.getX(), mouseEvent.getY()); } } } }); }
From source file:com.diversityarrays.kdxplore.field.FieldViewDialog.java
public FieldViewDialog(Window owner, String title, SampleGroupChoice sgcSamples, Trial trial, SampleGroupChoice sgcNewMedia, KDSmartDatabase db) throws IOException { super(owner, title, ModalityType.MODELESS); advanceRetreatControls = Box.createHorizontalBox(); advanceRetreatControls.add(new JButton(retreatAction)); advanceRetreatControls.add(new JButton(advanceAction)); autoAdvanceControls = Box.createHorizontalBox(); autoAdvanceControls.add(new JButton(autoAdvanceAction)); autoAdvanceOption.addActionListener(new ActionListener() { @Override// ww w. j a va 2s . c om public void actionPerformed(ActionEvent e) { updateMovementControls(); } }); this.database = db; this.sampleGroupChoiceForSamples = sgcSamples; this.sampleGroupChoiceForNewMedia = sgcNewMedia; NumberSpinner fontSpinner = new NumberSpinner(new SpinnerNumberModel(), "0.00"); this.fieldViewPanel = FieldViewPanel.create(database, trial, SeparatorVisibilityOption.VISIBLE, null, Box.createHorizontalGlue(), new JButton(showInfoAction), Box.createHorizontalGlue(), new JLabel("Font Size:"), fontSpinner, Box.createHorizontalGlue(), advanceRetreatControls, autoAdvanceOption, autoAdvanceControls); initialiseAction(advanceAction, "ic_object_advance_black.png", "Auto-Advance"); this.xyProvider = fieldViewPanel.getXYprovider(); this.traitMap = fieldViewPanel.getTraitMap(); fieldLayoutTable = fieldViewPanel.getFieldLayoutTable(); JScrollPane scrollPane = fieldViewPanel.getFieldTableScrollPane(); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); fieldLayoutTable.setTransferHandler(flth); fieldLayoutTable.setDropMode(DropMode.ON); fieldLayoutTable.addMouseListener(new MouseAdapter() { JPopupMenu popupMenu; @Override public void mouseClicked(MouseEvent e) { if (!SwingUtilities.isRightMouseButton(e) || 1 != e.getClickCount()) { return; } Point pt = e.getPoint(); int row = fieldLayoutTable.rowAtPoint(pt); if (row >= 0) { int col = fieldLayoutTable.columnAtPoint(pt); if (col >= 0) { Plot plot = fieldViewPanel.getPlotAt(col, row); if (plot != null) { if (popupMenu == null) { popupMenu = new JPopupMenu("View Attachments"); } popupMenu.removeAll(); Set<File> set = plot.getMediaFiles(); if (Check.isEmpty(set)) { popupMenu.add(new JMenuItem("No Attachments available")); } else { for (File file : set) { Action a = new AbstractAction(file.getName()) { @Override public void actionPerformed(ActionEvent e) { try { Desktop.getDesktop().browse(file.toURI()); } catch (IOException e1) { MsgBox.warn(FieldViewDialog.this, e1, file.getName()); } } }; popupMenu.add(new JMenuItem(a)); } } popupMenu.show(fieldLayoutTable, pt.x, pt.y); } } } } }); Font font = fieldLayoutTable.getFont(); float fontSize = font.getSize2D(); fontSizeModel = new SpinnerNumberModel(fontSize, fontSize, 50.0, 1.0); fontSpinner.setModel(fontSizeModel); fontSizeModel.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { float fsize = fontSizeModel.getNumber().floatValue(); System.out.println("Using fontSize=" + fsize); Font font = fieldLayoutTable.getFont().deriveFont(fsize); fieldLayoutTable.setFont(font); FontMetrics fm = fieldLayoutTable.getFontMetrics(font); int lineHeight = fm.getMaxAscent() + fm.getMaxDescent(); fieldLayoutTable.setRowHeight(4 * lineHeight); // GuiUtil.initialiseTableColumnWidths(fieldLayoutTable, false); fieldLayoutTable.repaint(); } }); fieldLayoutTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); fieldLayoutTable.setResizable(true, true); fieldLayoutTable.getTableColumnResizer().setResizeAllColumns(true); advanceAction.setEnabled(false); fieldLayoutTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { handlePlotSelection(); } } }); TableColumnModel columnModel = fieldLayoutTable.getColumnModel(); columnModel.addColumnModelListener(new TableColumnModelListener() { @Override public void columnSelectionChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { handlePlotSelection(); } } @Override public void columnRemoved(TableColumnModelEvent e) { } @Override public void columnMoved(TableColumnModelEvent e) { } @Override public void columnMarginChanged(ChangeEvent e) { } @Override public void columnAdded(TableColumnModelEvent e) { } }); PropertyChangeListener listener = new PropertyChangeListener() { // Use a timer and redisplay other columns when delay is GT 100 ms Timer timer = new Timer(true); TimerTask timerTask; long lastActive; boolean busy = false; private int eventColumnWidth; private TableColumn eventColumn; @Override public void propertyChange(PropertyChangeEvent evt) { if (busy) { return; } if (evt.getSource() instanceof TableColumn && "width".equals(evt.getPropertyName())) { eventColumn = (TableColumn) evt.getSource(); eventColumnWidth = eventColumn.getWidth(); lastActive = System.currentTimeMillis(); if (timerTask == null) { timerTask = new TimerTask() { @Override public void run() { if (System.currentTimeMillis() - lastActive > 200) { timerTask.cancel(); timerTask = null; busy = true; try { for (Enumeration<TableColumn> en = columnModel.getColumns(); en .hasMoreElements();) { TableColumn tc = en.nextElement(); if (tc != eventColumn) { tc.setWidth(eventColumnWidth); } } } finally { busy = false; } } } }; timer.scheduleAtFixedRate(timerTask, 100, 150); } } } }; for (Enumeration<TableColumn> en = columnModel.getColumns(); en.hasMoreElements();) { TableColumn tc = en.nextElement(); tc.addPropertyChangeListener(listener); } Map<Integer, Plot> plotById = new HashMap<>(); for (Plot plot : fieldViewPanel.getFieldLayout()) { plotById.put(plot.getPlotId(), plot); } TrialItemVisitor<Sample> sampleVisitor = new TrialItemVisitor<Sample>() { @Override public void setExpectedItemCount(int count) { } @Override public boolean consumeItem(Sample sample) throws IOException { Plot plot = plotById.get(sample.getPlotId()); if (plot == null) { throw new IOException("Missing plot for plotId=" + sample.getPlotId() + " sampleIdent=" + Util.createUniqueSampleKey(sample)); } plot.addSample(sample); SampleCounts counts = countsByTraitId.get(sample.getTraitId()); if (counts == null) { counts = new SampleCounts(); countsByTraitId.put(sample.getTraitId(), counts); } if (sample.hasBeenScored()) { ++counts.scored; } else { ++counts.unscored; } return true; } }; database.visitSamplesForTrial(sampleGroupChoiceForSamples, trial.getTrialId(), SampleOrder.ALL_BY_PLOT_ID_THEN_TRAIT_ID_THEN_INSTANCE_NUMBER_ORDER_THEN_SPECIMEN_NUMBER, sampleVisitor); setDefaultCloseOperation(DISPOSE_ON_CLOSE); this.trial = trial; KDClientUtils.initAction(ImageId.SETTINGS_24, showInfoAction, "Trial Summary"); Action clear = new AbstractAction("Clear") { @Override public void actionPerformed(ActionEvent e) { infoTextArea.setText(""); } }; JPanel bottom = new JPanel(new BorderLayout()); bottom.add(GuiUtil.createLabelSeparator("Plot Details", new JButton(clear)), BorderLayout.NORTH); bottom.add(new JScrollPane(infoTextArea), BorderLayout.CENTER); JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, fieldViewPanel, new JScrollPane(infoTextArea)); splitPane.setResizeWeight(0.0); splitPane.setOneTouchExpandable(true); setContentPane(splitPane); updateMovementControls(); pack(); }
From source file:lu.lippmann.cdb.ext.hydviga.ui.GapFillingKnowledgeDBExplorerFrame.java
/** * Constructor.// ww w . j av a 2 s. c o m */ GapFillingKnowledgeDBExplorerFrame(final Instances ds, final int dateIdx, final StationsDataProvider gcp) throws Exception { LogoHelper.setLogo(this); this.setTitle("KnowledgeDB: explorer"); this.gcp = gcp; this.tablePanel = new JXPanel(); this.tablePanel.setBorder(new TitledBorder("Cases")); final JXPanel highPanel = new JXPanel(); highPanel.setLayout(new BoxLayout(highPanel, BoxLayout.X_AXIS)); highPanel.add(this.tablePanel); this.geomapPanel = new JXPanel(); this.geomapPanel.add(buildGeoMapChart(new ArrayList<String>(), new ArrayList<String>())); highPanel.add(this.geomapPanel); this.caseChartPanel = new JXPanel(); this.caseChartPanel.setBorder(new TitledBorder("Inspected fake gap")); this.mostSimilarChartPanel = new JXPanel(); this.mostSimilarChartPanel.setBorder(new TitledBorder("Most similar")); this.nearestChartPanel = new JXPanel(); this.nearestChartPanel.setBorder(new TitledBorder("Nearest")); this.downstreamChartPanel = new JXPanel(); this.downstreamChartPanel.setBorder(new TitledBorder("Downstream")); this.upstreamChartPanel = new JXPanel(); this.upstreamChartPanel.setBorder(new TitledBorder("Upstream")); getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.PAGE_AXIS)); //getContentPane().add(new JCheckBox("Use incomplete series")); getContentPane().add(highPanel); //getContentPane().add(new JXButton("Export")); getContentPane().add(caseChartPanel); getContentPane().add(mostSimilarChartPanel); getContentPane().add(nearestChartPanel); getContentPane().add(downstreamChartPanel); getContentPane().add(upstreamChartPanel); //final Instances kdbDS=GapFillingKnowledgeDB.getKnowledgeDBWithBestCasesOnly(); final Instances kdbDS = GapFillingKnowledgeDB.getKnowledgeDB(); final JXTable gapsTable = buidJXTable(kdbDS); final JScrollPane tableScrollPane = new JScrollPane(gapsTable); tableScrollPane.setPreferredSize( new Dimension(COMPONENT_WIDTH - 100, 40 + (int) (tableScrollPane.getPreferredSize().getHeight()))); this.tablePanel.add(tableScrollPane); gapsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); gapsTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(final ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { final int modelRow = gapsTable.getSelectedRow(); final String attrname = gapsTable.getModel().getValueAt(modelRow, 1).toString(); final int gapsize = (int) Double .valueOf(gapsTable.getModel().getValueAt(modelRow, 4).toString()).doubleValue(); final int position = (int) Double .valueOf(gapsTable.getModel().getValueAt(modelRow, 5).toString()).doubleValue(); final String mostSimilarFlag = gapsTable.getModel().getValueAt(modelRow, 14).toString(); final String nearestFlag = gapsTable.getModel().getValueAt(modelRow, 15).toString(); final String downstreamFlag = gapsTable.getModel().getValueAt(modelRow, 16).toString(); final String upstreamFlag = gapsTable.getModel().getValueAt(modelRow, 17).toString(); final String algoname = gapsTable.getModel().getValueAt(modelRow, 12).toString(); final boolean useDiscretizedTime = Boolean .valueOf(gapsTable.getModel().getValueAt(modelRow, 13).toString()); try { geomapPanel.removeAll(); caseChartPanel.removeAll(); mostSimilarChartPanel.removeAll(); nearestChartPanel.removeAll(); downstreamChartPanel.removeAll(); upstreamChartPanel.removeAll(); final Set<String> selected = new HashSet<String>(); final Instances tmpds = WekaDataProcessingUtil.buildFilteredDataSet(ds, 0, ds.numAttributes() - 1, Math.max(0, position - GapsUtil.getCountOfValuesBeforeAndAfter(gapsize)), Math.min(position + gapsize + GapsUtil.getCountOfValuesBeforeAndAfter(gapsize), ds.numInstances() - 1)); final List<String> attributeNames = WekaTimeSeriesUtil .getNamesOfAttributesWithoutGap(tmpds); //final List<String> attributeNames=WekaDataStatsUtil.getAttributeNames(ds); attributeNames.remove(attrname); attributeNames.remove("timestamp"); if (Boolean.valueOf(mostSimilarFlag)) { final String mostSimilarStationName = WekaTimeSeriesSimilarityUtil .findMostSimilarTimeSerie(tmpds, tmpds.attribute(attrname), attributeNames, false); selected.add(mostSimilarStationName); final Attribute mostSimilarStationAttr = tmpds.attribute(mostSimilarStationName); final ChartPanel cp0 = GapsUIUtil.buildGapChartPanel(ds, dateIdx, mostSimilarStationAttr, gapsize, position); cp0.getChart().removeLegend(); cp0.setPreferredSize(CHART_DIMENSION); mostSimilarChartPanel.add(cp0); } if (Boolean.valueOf(nearestFlag)) { final String nearestStationName = gcp.findNearestStation(attrname, attributeNames); selected.add(nearestStationName); final Attribute nearestStationAttr = ds.attribute(nearestStationName); final ChartPanel cp0 = GapsUIUtil.buildGapChartPanel(ds, dateIdx, nearestStationAttr, gapsize, position); cp0.getChart().removeLegend(); cp0.setPreferredSize(CHART_DIMENSION); nearestChartPanel.add(cp0); } if (Boolean.valueOf(downstreamFlag)) { final String downstreamStationName = gcp.findDownstreamStation(attrname, attributeNames); selected.add(downstreamStationName); final Attribute downstreamStationAttr = ds.attribute(downstreamStationName); final ChartPanel cp0 = GapsUIUtil.buildGapChartPanel(ds, dateIdx, downstreamStationAttr, gapsize, position); cp0.getChart().removeLegend(); cp0.setPreferredSize(CHART_DIMENSION); downstreamChartPanel.add(cp0); } if (Boolean.valueOf(upstreamFlag)) { final String upstreamStationName = gcp.findUpstreamStation(attrname, attributeNames); selected.add(upstreamStationName); final Attribute upstreamStationAttr = ds.attribute(upstreamStationName); final ChartPanel cp0 = GapsUIUtil.buildGapChartPanel(ds, dateIdx, upstreamStationAttr, gapsize, position); cp0.getChart().removeLegend(); cp0.setPreferredSize(CHART_DIMENSION); upstreamChartPanel.add(cp0); } final GapFiller gapFiller = GapFillerFactory.getGapFiller(algoname, useDiscretizedTime); final ChartPanel cp = GapsUIUtil.buildGapChartPanelWithCorrection(ds, dateIdx, ds.attribute(attrname), gapsize, position, gapFiller, selected); cp.getChart().removeLegend(); cp.setPreferredSize(new Dimension((int) CHART_DIMENSION.getWidth(), (int) (CHART_DIMENSION.getHeight() * 1.5))); caseChartPanel.add(cp); geomapPanel.add(buildGeoMapChart(Arrays.asList(attrname), selected)); getContentPane().repaint(); pack(); } catch (Exception e1) { e1.printStackTrace(); } } } }); gapsTable.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(final MouseEvent e) { if (!e.isPopupTrigger()) { // nothing? } else { final JPopupMenu jPopupMenu = new JPopupMenu("feur"); final JMenuItem mExport = new JMenuItem("Export this table as CSV"); mExport.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final JFileChooser fc = new JFileChooser(); fc.setAcceptAllFileFilterUsed(false); final int returnVal = fc.showSaveDialog(gapsTable); if (returnVal == JFileChooser.APPROVE_OPTION) { try { final File file = fc.getSelectedFile(); WekaDataAccessUtil.saveInstancesIntoCSVFile(kdbDS, file); } catch (Exception ee) { ee.printStackTrace(); } } } }); jPopupMenu.add(mExport); jPopupMenu.show(gapsTable, e.getX(), e.getY()); } } }); setPreferredSize(new Dimension(FRAME_WIDTH, 1000)); pack(); setVisible(true); /* select the first row */ gapsTable.setRowSelectionInterval(0, 0); }
From source file:javazoom.jlgui.player.amp.PlayerUI.java
public void loadSkin() { log.info("Load PlayerUI (EDT=" + SwingUtilities.isEventDispatchThread() + ")"); removeAll();//w ww .j a va2 s . co m // Load skin specified in args if (ui.getPath() != null) { log.info("Load default skin from " + ui.getPath()); ui.loadSkin(ui.getPath()); config.setDefaultSkin(ui.getPath()); } // Load skin specified in jlgui.ini else if ((config.getDefaultSkin() != null) && (!config.getDefaultSkin().trim().equals(""))) { log.info("Load default skin from " + config.getDefaultSkin()); ui.loadSkin(config.getDefaultSkin()); } // Default included skin else { ClassLoader cl = getClass().getClassLoader(); InputStream sis = cl.getResourceAsStream("javazoom/jlgui/player/amp/metrix.wsz"); log.info("Load default skin for JAR"); ui.loadSkin(sis); } // Background ImageBorder border = new ImageBorder(); border.setImage(ui.getMainImage()); setBorder(border); // Buttons add(ui.getAcPrevious(), ui.getAcPrevious().getConstraints()); ui.getAcPrevious().removeActionListener(this); ui.getAcPrevious().addActionListener(this); add(ui.getAcPlay(), ui.getAcPlay().getConstraints()); ui.getAcPlay().removeActionListener(this); ui.getAcPlay().addActionListener(this); add(ui.getAcPause(), ui.getAcPause().getConstraints()); ui.getAcPause().removeActionListener(this); ui.getAcPause().addActionListener(this); add(ui.getAcStop(), ui.getAcStop().getConstraints()); ui.getAcStop().removeActionListener(this); ui.getAcStop().addActionListener(this); add(ui.getAcNext(), ui.getAcNext().getConstraints()); ui.getAcNext().removeActionListener(this); ui.getAcNext().addActionListener(this); add(ui.getAcEject(), ui.getAcEject().getConstraints()); ui.getAcEject().removeActionListener(this); ui.getAcEject().addActionListener(this); // EqualizerUI toggle add(ui.getAcEqualizer(), ui.getAcEqualizer().getConstraints()); ui.getAcEqualizer().removeActionListener(this); ui.getAcEqualizer().addActionListener(this); // Playlist toggle add(ui.getAcPlaylist(), ui.getAcPlaylist().getConstraints()); ui.getAcPlaylist().removeActionListener(this); ui.getAcPlaylist().addActionListener(this); // Shuffle toggle add(ui.getAcShuffle(), ui.getAcShuffle().getConstraints()); ui.getAcShuffle().removeActionListener(this); ui.getAcShuffle().addActionListener(this); // Repeat toggle add(ui.getAcRepeat(), ui.getAcRepeat().getConstraints()); ui.getAcRepeat().removeActionListener(this); ui.getAcRepeat().addActionListener(this); // Volume add(ui.getAcVolume(), ui.getAcVolume().getConstraints()); ui.getAcVolume().removeChangeListener(this); ui.getAcVolume().addChangeListener(this); // Balance add(ui.getAcBalance(), ui.getAcBalance().getConstraints()); ui.getAcBalance().removeChangeListener(this); ui.getAcBalance().addChangeListener(this); // Seek bar add(ui.getAcPosBar(), ui.getAcPosBar().getConstraints()); ui.getAcPosBar().removeChangeListener(this); ui.getAcPosBar().addChangeListener(this); // Mono add(ui.getAcMonoIcon(), ui.getAcMonoIcon().getConstraints()); // Stereo add(ui.getAcStereoIcon(), ui.getAcStereoIcon().getConstraints()); // Title label add(ui.getAcTitleLabel(), ui.getAcTitleLabel().getConstraints()); // Sample rate label add(ui.getAcSampleRateLabel(), ui.getAcSampleRateLabel().getConstraints()); // Bit rate label add(ui.getAcBitRateLabel(), ui.getAcBitRateLabel().getConstraints()); // Play icon add(ui.getAcPlayIcon(), ui.getAcPlayIcon().getConstraints()); // Time icon add(ui.getAcTimeIcon(), ui.getAcTimeIcon().getConstraints()); // MinuteH number add(ui.getAcMinuteH(), ui.getAcMinuteH().getConstraints()); // MinuteL number add(ui.getAcMinuteL(), ui.getAcMinuteL().getConstraints()); // SecondH number add(ui.getAcSecondH(), ui.getAcSecondH().getConstraints()); // SecondL number add(ui.getAcSecondL(), ui.getAcSecondL().getConstraints()); // TitleBar add(ui.getAcTitleBar(), ui.getAcTitleBar().getConstraints()); add(ui.getAcMinimize(), ui.getAcMinimize().getConstraints()); ui.getAcMinimize().removeActionListener(this); ui.getAcMinimize().addActionListener(this); add(ui.getAcExit(), ui.getAcExit().getConstraints()); ui.getAcExit().removeActionListener(this); ui.getAcExit().addActionListener(this); // DSP if (ui.getAcAnalyzer() != null) { add(ui.getAcAnalyzer(), ui.getAcAnalyzer().getConstraints()); } // Popup menu mainpopup = new JPopupMenu(ui.getResource("popup.title")); JMenuItem mi = new JMenuItem(Skin.TITLETEXT + "- JavaZOOM"); //mi.removeActionListener(this); //mi.addActionListener(this); mainpopup.add(mi); mainpopup.addSeparator(); JMenu playSubMenu = new JMenu(ui.getResource("popup.play")); miPlayFile = new JMenuItem(ui.getResource("popup.play.file")); miPlayFile.setActionCommand(PlayerActionEvent.MIPLAYFILE); miPlayFile.removeActionListener(this); miPlayFile.addActionListener(this); miPlayLocation = new JMenuItem(ui.getResource("popup.play.location")); miPlayLocation.setActionCommand(PlayerActionEvent.MIPLAYLOCATION); miPlayLocation.removeActionListener(this); miPlayLocation.addActionListener(this); playSubMenu.add(miPlayFile); playSubMenu.add(miPlayLocation); mainpopup.add(playSubMenu); mainpopup.addSeparator(); miPlaylist = new JCheckBoxMenuItem(ui.getResource("popup.playlist")); miPlaylist.setActionCommand(PlayerActionEvent.MIPLAYLIST); if (config.isPlaylistEnabled()) miPlaylist.setState(true); miPlaylist.removeActionListener(this); miPlaylist.addActionListener(this); mainpopup.add(miPlaylist); miEqualizer = new JCheckBoxMenuItem(ui.getResource("popup.equalizer")); miEqualizer.setActionCommand(PlayerActionEvent.MIEQUALIZER); if (config.isEqualizerEnabled()) miEqualizer.setState(true); miEqualizer.removeActionListener(this); miEqualizer.addActionListener(this); mainpopup.add(miEqualizer); mainpopup.addSeparator(); mi = new JMenuItem(ui.getResource("popup.preferences")); mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, ActionEvent.CTRL_MASK, false)); mi.setActionCommand(PlayerActionEvent.MIPREFERENCES); mi.removeActionListener(this); mi.addActionListener(this); mainpopup.add(mi); JMenu skinsSubMenu = new JMenu(ui.getResource("popup.skins")); mi = new JMenuItem(ui.getResource("popup.skins.browser")); mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.ALT_MASK, false)); mi.setActionCommand(PlayerActionEvent.MISKINBROWSER); mi.removeActionListener(this); mi.addActionListener(this); skinsSubMenu.add(mi); mi = new JMenuItem(ui.getResource("popup.skins.load")); mi.setActionCommand(PlayerActionEvent.MILOADSKIN); mi.removeActionListener(this); mi.addActionListener(this); skinsSubMenu.add(mi); mainpopup.add(skinsSubMenu); JMenu playbackSubMenu = new JMenu(ui.getResource("popup.playback")); mi = new JMenuItem(ui.getResource("popup.playback.jump")); mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_J, 0, false)); mi.setActionCommand(PlayerActionEvent.MIJUMPFILE); mi.removeActionListener(this); mi.addActionListener(this); playbackSubMenu.add(mi); mi = new JMenuItem(ui.getResource("popup.playback.stop")); mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, 0, false)); mi.setActionCommand(PlayerActionEvent.MISTOP); mi.removeActionListener(this); mi.addActionListener(this); playbackSubMenu.add(mi); mainpopup.add(playbackSubMenu); mainpopup.addSeparator(); mi = new JMenuItem(ui.getResource("popup.exit")); mi.setActionCommand(PlayerActionEvent.ACEXIT); mi.removeActionListener(this); mi.addActionListener(this); mainpopup.add(mi); // Popup menu on TitleBar ui.getAcTitleBar().removeMouseListener(popupAdapter); popupAdapter = new PopupAdapter(mainpopup); ui.getAcTitleBar().addMouseListener(popupAdapter); // Popup menu on Eject button ejectpopup = new JPopupMenu(); mi = new JMenuItem(ui.getResource("popup.eject.openfile")); mi.setActionCommand(PlayerActionEvent.MIPLAYFILE); mi.removeActionListener(this); mi.addActionListener(this); ejectpopup.add(mi); mi = new JMenuItem(ui.getResource("popup.eject.openlocation")); mi.setActionCommand(PlayerActionEvent.MIPLAYLOCATION); mi.removeActionListener(this); mi.addActionListener(this); ejectpopup.add(mi); ui.getAcEject().removeMouseListener(ejectpopupAdapter); ejectpopupAdapter = new PopupAdapter(ejectpopup); ui.getAcEject().addMouseListener(ejectpopupAdapter); // EqualizerUI if (equalizerUI != null) equalizerUI.loadUI(); if (playlistUI != null) playlistUI.loadUI(); validate(); loader.loaded(); }
From source file:com.googlecode.bpmn_simulator.gui.BPMNSimulatorFrame.java
private JToolBar createDefinitionToolbar() { final JButton openButton = new JButton(Theme.ICON_OPEN); openButton.setToolTipText(Messages.getString("Toolbar.open")); //$NON-NLS-1$ openButton.addActionListener(new ActionListener() { @Override/*from ww w .ja v a 2 s. c o m*/ public void actionPerformed(final ActionEvent event) { openFile(); } }); definitionToolbar.add(openButton); final JPopupMenu importMenu = new JPopupMenu(Messages.getString("Toolbar.import")); //$NON-NLS-1$ final JMenuItem importBonitaItem = new JMenuItem("Bonita"); importBonitaItem.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent event) { importBonita(); } }); importMenu.add(importBonitaItem); final JButton importButton = new JButton(Theme.ICON_IMPORT); importButton.setToolTipText(Messages.getString("Toolbar.import")); //$NON-NLS-1$ importButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent event) { importMenu.show(importButton, 0, importButton.getHeight()); } }); definitionToolbar.add(importButton); return definitionToolbar; }