/** * This function is used to re-run the analyser, and re-create the rows corresponding the its * results. */ private void refreshReviewTable() { reviewPanel.removeAll(); rows.clear(); GridBagLayout gbl = new GridBagLayout(); reviewPanel.setLayout(gbl); GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridy = 0; try { Map<String, Long> sums = analyser.processLogFile(config.getLogFilename(), fromDate.getDate(), toDate.getDate()); for (Entry<String, Long> entry : sums.entrySet()) { String project = entry.getKey(); double hours = 1.0 * entry.getValue() / (1000 * 3600); addRow(gbl, gbc, project, hours); } for (String project : main.getProjectsTree().getTopLevelProjects()) if (!rows.containsKey(project)) addRow(gbl, gbc, project, 0); gbc.insets = new Insets(10, 0, 0, 0); addLeftLabel(gbl, gbc, "TOTAL"); gbc.gridx = 1; gbc.weightx = 1; totalLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 3)); gbl.setConstraints(totalLabel, gbc); reviewPanel.add(totalLabel); gbc.weightx = 0; addRightLabel(gbl, gbc); } catch (IOException e) { e.printStackTrace(); } recomputeTotal(); pack(); }
private void winning() { String[] options = {"Try again", "Go back to Start", "Quit"}; InformationFrame.stopClock(); int n = JOptionPane.showOptionDialog( rootPane, "You won!" + "\n╔══╗░░░░╔╦╗░░╔═════╗" + "\n║╚═╬════╬╣╠═╗║░▀░▀░║" + "\n╠═╗║╔╗╔╗║║║╩╣║╚═══╝║" + "\n╚══╩╝╚╝╚╩╩╩═╝╚═════╝", "Smileys c: ☺ ☻ ت ヅ ツ ッ シ Ü ϡ ﭢ" + "\nWhat would you like to do now?", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[2]); if (n == 2) { // System.out.println("n = " + n); System.exit(0); } else if (n == 1) { InformationFrame.dispose(); main(null); this.dispose(); } else if (n == 0) { String difficulty = MainManager.getMainGrid().getDifficulty(); MainPanel.removeAll(); constructMinesweeper(difficulty.toLowerCase()); } }
public void actionPerformed(ActionEvent e) { if (e.getSource() == ctl) { this.menu(); } else if (e.getSource() == exit) { exitPerform(); } else if (e.getSource() == rank) { if (count != 0) { card.show(mainPanel, "four"); rankPanel.setMemory(memory, count - 1); buttonPanel.removeAll(); buttonPanel.setBounds(width - 200, height - 80, 190, 50); buttonPanel.add(exit); check = 4; count--; } } else if (e.getSource() == back) { if (secondPanel.clip != null) { secondPanel.clip.stop(); System.out.printf("test"); } check = 0; card.previous(mainPanel); buttonPanel.removeAll(); ctl.setText("- Play -"); buttonPanel.add(ctl); buttonPanel.add(rank); buttonPanel.add(exit); buttonPanel.setOpaque(false); buttonPanel.setBounds(width / 2 - 50, height / 2 - 50, 80, 100); } }
private void resetSemImEditor() { java.util.List<SemEstimator> semEstimators = wrapper.getMultipleResultList(); if (semEstimators.size() == 1) { SemEstimator estimatedSem = semEstimators.get(0); SemImEditor editor = new SemImEditor(new SemImWrapper(estimatedSem.getEstimatedSem())); panel.removeAll(); panel.add(editor, BorderLayout.CENTER); panel.revalidate(); panel.repaint(); } else { JTabbedPane tabs = new JTabbedPane(); for (int i = 0; i < semEstimators.size(); i++) { SemEstimator estimatedSem = semEstimators.get(i); SemImEditor editor = new SemImEditor(new SemImWrapper(estimatedSem.getEstimatedSem())); JPanel _panel = new JPanel(); _panel.setLayout(new BorderLayout()); _panel.add(editor, BorderLayout.CENTER); tabs.addTab(estimatedSem.getDataSet().getName(), _panel); } panel.removeAll(); panel.add(tabs); panel.validate(); } }
public void stateChanged(ChangeEvent e) { JSpinner source = (JSpinner) e.getSource(); if (source.getName().equals("Hour")) { calendar.set(Calendar.HOUR_OF_DAY, getSelectedHour()); return; } if (source.getName().equals("Year")) { calendar.set(Calendar.YEAR, getSelectedYear()); dayPanel.removeAll(); this.flushWeekAndDayPanal(calendar); dayPanel.revalidate(); dayPanel.updateUI(); return; } if (source.getName().equals("Month")) { calendar.set(Calendar.MONTH, getSelectedMonth() - 1); dayPanel.removeAll(); this.flushWeekAndDayPanal(calendar); dayPanel.revalidate(); dayPanel.updateUI(); return; } }
/** * Update changing components. * * @see javax.swing.JComponent#paintComponent(java.awt.Graphics) */ @Override public void paintComponent(Graphics g) { money.setText(String.valueOf(player.getMoney())); record.setText(String.valueOf(bestScore)); dealerPanel.removeAll(); playerPanel.removeAll(); for (Card dealerCard : dealer.getCards()) dealerPanel.add(dealerCard); for (Card playerCard : player.getCards()) playerPanel.add(playerCard); revalidate(); }
/** Presune obraz figury z pozice inx0 na pozici inx1. */ public void moveFig(int inx0, int inx1) { JPanel panel0, panel1; panel0 = (JPanel) figurePan.getComponent(inx0); panel1 = (JPanel) figurePan.getComponent(inx1); Component c = panel0.getComponent(0); panel0.removeAll(); panel1.removeAll(); panel1.add(c); panel0.revalidate(); panel1.revalidate(); }
private void setupCentralPanel() { myCentralPanel.removeAll(); if (myUsagePreviewPanel != null) { Disposer.dispose(myUsagePreviewPanel); myUsagePreviewPanel = null; } JScrollPane pane = ScrollPaneFactory.createScrollPane(myTree); if (UsageViewSettings.getInstance().IS_PREVIEW_USAGES) { Splitter splitter = new Splitter(false, UsageViewSettings.getInstance().PREVIEW_USAGES_SPLITTER_PROPORTIONS); pane.putClientProperty(UIUtil.KEEP_BORDER_SIDES, SideBorder.RIGHT); splitter.setFirstComponent(pane); myUsagePreviewPanel = new UsagePreviewPanel(myProject); myUsagePreviewPanel.setBorder(IdeBorderFactory.createBorder(SideBorder.LEFT)); Disposer.register(this, myUsagePreviewPanel); splitter.setSecondComponent(myUsagePreviewPanel); myCentralPanel.add(splitter, BorderLayout.CENTER); } else { myCentralPanel.add(pane, BorderLayout.CENTER); } myCentralPanel.add(myButtonPanel, BorderLayout.SOUTH); myRootPanel.revalidate(); }
public void changePanel() { card.next(mainPanel); buttonPanel.removeAll(); ctl.setText("- Play -"); buttonPanel.add(ctl); buttonPanel.add(rank); buttonPanel.add(exit); buttonPanel.setOpaque(false); buttonPanel.setBounds(width / 2 - 50, height / 2 - 50, 80, 100); count++; memory[count] = new Memory(); menuPanel.setMemory(memory[count]); secondPanel.setMemory(memory[count]); gamePanel.setMemory(memory[count]); rankPanel.setMemory(memory, count); check = 0; System.out.println( count + " " + memory[count - 1].name + " " + memory[count - 1].song + " " + memory[count - 1].score); }
public void filterPacks() { packPanels.clear(); packs.removeAll(); currentPacks.clear(); packMapping.clear(); int counter = 0; selectedPack = 0; packInfo.setText(""); // all removed, repaint packs.repaint(); // not really needed // modPacksAdded = false; for (ModPack pack : ModPack.getPackArray()) { if (filterForTab(pack) && mcVersionCheck(pack) && avaliabilityCheck(pack) && textSearch(pack)) { currentPacks.put(counter, pack); packMapping.put(counter, pack.getIndex()); addPack(pack); counter++; } } updateDatas(); updatePacks(); }
private void applySize(int rows, int columns) { gauges.setLayout(new GridLayout(rows, columns)); gauges.removeAll(); for (int i = 0; i < rows * columns; i++) { String gaugeName = config.getProperty(getKey(i), DEFAULT_LAYOUT[i].name()); Sensor sensor; try { sensor = Sensor.valueOf(Sensor.class, gaugeName); } catch (IllegalArgumentException e) { sensor = DEFAULT_LAYOUT[i]; } final int currentGaugeIndex = i; gauges.add( SensorGauge.createGauge( sensor, new SensorGauge.GaugeChangeListener() { @Override public void onSensorChange(Sensor sensor) { config.setProperty(getKey(currentGaugeIndex), sensor.name()); } })); } saveConfig(rows, columns); }
@Override public void reload(ScreenDeviceInfo deviceInfo) { super.reload(deviceInfo); JPanel contentPanel = getPanel().getContentPanel(); contentPanel.removeAll(); GridBagConstraints constraints = new GridBagConstraints(); constraints.weightx = 1.0; constraints.weightx = 1.0; constraints.fill = GridBagConstraints.BOTH; constraints.gridx = GridBagConstraints.REMAINDER; constraints.gridy = GridBagConstraints.RELATIVE; constraints.anchor = GridBagConstraints.NORTHWEST; for (DesignComponent item : getChildren()) { ScreenDisplayPresenter presenter = item.getPresenter(ScreenDisplayPresenter.class); if (presenter == null) { continue; } contentPanel.add(presenter.getView(), constraints); presenter.reload(deviceInfo); } constraints.weighty = 1.0; constraints.anchor = GridBagConstraints.CENTER; contentPanel.add(fillPanel, constraints); }
public void redrawCommande() { itemPanel.removeAll(); OrderedItem orders[] = commande.getOrders(); GridBagConstraints c = new GridBagConstraints(); c.gridy = GridBagConstraints.RELATIVE; c.fill = GridBagConstraints.BOTH; for (int i = 0; i < orders.length; i++) { c.gridx = 0; JPanel itemLabelHolder = new JPanel(); itemLabelHolder.add(new JLabel(orders[i].getItem().getNom())); itemLabelHolder.setBackground(Color.WHITE); itemLabelHolder.setBorder(BorderFactory.createLineBorder(Color.BLUE)); itemPanel.add(itemLabelHolder, c); c.gridx = 1; itemPanel.add(new OrderedItemPanel(orders[i]), c); c.gridx = 2; JButton killButton = new JButton("\u2716"); killButton.setBackground(Color.RED); killButton.setForeground(Color.WHITE); killButton.addActionListener(getHandler()); killButton.setActionCommand("CDelete" + i); JPanel buttonHolder = new JPanel(); buttonHolder.add(killButton); itemPanel.add(buttonHolder, c); } validate(); repaint(); }
private void resetPanel() { if (!options.hasData()) { currentPartition = null; optionsPanels.clear(); optionsPanelParent.removeAll(); } }
public JPanel drawBoard(Piece[][] boardState) throws IOException { boardFrame.removeAll(); boardSquares = new JPanel[8][8]; for (int i = 0; i < boardSquares.length; i++) { for (int j = 0; j < boardSquares.length; j++) { JPanel square = new JPanel(); if ((j % 2 == 1 && i % 2 == 1) || (j % 2 == 0 && i % 2 == 0)) { square.setBackground(Color.WHITE); if (boardState[i][j] != null) { square.add(determinePiece(boardState[i][j])); } } else { square.setBackground(Color.gray); if (boardState[i][j] != null) { square.add(determinePiece(boardState[i][j])); } } boardFrame.add(square); } } return boardFrame; }
private void setChoosers() { fieldPanel.removeAll(); for (int i = 0; i < choosers.size(); i++) { Chooser c = (Chooser) choosers.get(i); if (c.isWanted) fieldPanel.add(c.field); } }
private void updateEditorText() { disposeNonTextEditor(); final PsiElement elt = myElements[myIndex].getNavigationElement(); Project project = elt.getProject(); PsiFile psiFile = getContainingFile(elt); final VirtualFile vFile = psiFile.getVirtualFile(); if (vFile == null) return; final FileEditorProvider[] providers = FileEditorProviderManager.getInstance().getProviders(project, vFile); for (FileEditorProvider provider : providers) { if (provider instanceof TextEditorProvider) { updateTextElement(elt); myBinarySwitch.show(myViewingPanel, TEXT_PAGE_KEY); break; } else if (provider.accept(project, vFile)) { myCurrentNonTextEditorProvider = provider; myNonTextEditor = myCurrentNonTextEditorProvider.createEditor(project, vFile); myBinaryPanel.removeAll(); myBinaryPanel.add(myNonTextEditor.getComponent()); myBinarySwitch.show(myViewingPanel, BINARY_PAGE_KEY); break; } } }
void update(String group) { myTitleLabel.setText( "<html><body><h2 style=\"text-align:left;\">" + group + "</h2></body></html>"); myContentPanel.removeAll(); List<IdSet> idSets = PluginGroups.getInstance().getSets(group); for (final IdSet set : idSets) { final JCheckBox checkBox = new JCheckBox(set.getTitle(), PluginGroups.getInstance().isIdSetAllEnabled(set)); checkBox.setModel( new JToggleButton.ToggleButtonModel() { @Override public boolean isSelected() { return PluginGroups.getInstance().isIdSetAllEnabled(set); } }); checkBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { PluginGroups.getInstance().setIdSetEnabled(set, !checkBox.isSelected()); CustomizePluginsStepPanel.this.repaint(); } }); myContentPanel.add(checkBox); } }
// Fees update method private void updateFeesData(long id) { String columns[] = {"Course", "Fees Payed", "Total fees", "Installments"}; try { Database db = new Database(); panel_7.removeAll(); feestablemodel = new MyTableModel(db.getFeeData(id), columns); feestable = new JTable(feestablemodel); feestable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); feestable.getSelectionModel().addListSelectionListener(this); feesscrollpane = new JScrollPane(feestable); panel_7.add(feesscrollpane); // change fees payed label feespayedlabel.setText("Fees Payed"); feesduelabel.setText("Fees Due"); totalfeeslabel.setText("Total Fees"); panel_7.revalidate(); } catch (Exception e) { JOptionPane.showMessageDialog(this, e.getMessage(), null, JOptionPane.ERROR_MESSAGE); } }
private void populateShop() { final String constraints1 = "w 60px, h 26px!"; final String constraints2 = "w 150px!, h 26px!"; pnlShop.setOpaque(false); pnlShop.setLayout(new MigLayout("insets 0, gap 0, wrap 2, hidemode 3")); pnlShop.removeAll(); pnlShop.add(lblErrShop, "w 100%!, h 30px!, span 2 1"); pnlShop.add(new FLabel.Builder().text("Maximum Packs").build(), constraints2); pnlShop.add(new PrefInput(QPref.SHOP_MAX_PACKS, QuestPreferencesErrType.SHOP), constraints1); pnlShop.add(new FLabel.Builder().text("Starting Packs").build(), constraints2); pnlShop.add( new PrefInput(QPref.SHOP_STARTING_PACKS, QuestPreferencesErrType.SHOP), constraints1); pnlShop.add(new FLabel.Builder().text("Wins for Pack").build(), constraints2); pnlShop.add( new PrefInput(QPref.SHOP_WINS_FOR_ADDITIONAL_PACK, QuestPreferencesErrType.SHOP), constraints1); pnlShop.add(new FLabel.Builder().text("Wins per Set Unlock").build(), constraints2); pnlShop.add(new PrefInput(QPref.WINS_UNLOCK_SET, QuestPreferencesErrType.SHOP), constraints1); pnlShop.add(new FLabel.Builder().text("Common Singles").build(), constraints2); pnlShop.add( new PrefInput(QPref.SHOP_SINGLES_COMMON, QuestPreferencesErrType.SHOP), constraints1); pnlShop.add(new FLabel.Builder().text("Uncommon Singles").build(), constraints2); pnlShop.add( new PrefInput(QPref.SHOP_SINGLES_UNCOMMON, QuestPreferencesErrType.SHOP), constraints1); pnlShop.add(new FLabel.Builder().text("Rare Singles").build(), constraints2); pnlShop.add(new PrefInput(QPref.SHOP_SINGLES_RARE, QuestPreferencesErrType.SHOP), constraints1); }
protected void showErrorPage(final ErrorInfo info) { storeState(); hideProgress(); myRootComponent = null; myErrorMessages.removeAll(); if (info.myShowStack) { info.myMessages.add( 0, new FixableMessageInfo(true, info.myDisplayMessage, "", "", null, null)); ByteArrayOutputStream stream = new ByteArrayOutputStream(); info.myThrowable.printStackTrace(new PrintStream(stream)); myErrorStack.setText(stream.toString()); myErrorStackLayout.show(myErrorStackPanel, ERROR_STACK_CARD); } else { myErrorStack.setText(null); myErrorStackLayout.show(myErrorStackPanel, ERROR_NO_STACK_CARD); } for (FixableMessageInfo message : info.myMessages) { addErrorMessage( message, message.myErrorIcon ? Messages.getErrorIcon() : Messages.getWarningIcon()); } myErrorPanel.revalidate(); myLayout.show(this, ERROR_CARD); DesignerToolWindowManager.getInstance(getProject()).refresh(true); repaint(); }
/** Show/update/hide page number field, according to loading policy and current data length. */ public final void updatePageNumber(int pageNr) { controlPageNr.setValue(new Integer(pageNr)); pageNrPanel.removeAll(); if (pageNr > 0 && showPageNumber) pageNrPanel.add(controlPageNr); pageNrPanel.revalidate(); this.repaint(); }
@Override public void reset() { List<X509Certificate> original = myTrustManager.getCertificates(); myTreeBuilder.reset(original); myCertificates.clear(); myCertificates.addAll(original); myDetailsPanel.removeAll(); myDetailsPanel.add(myEmptyPanel, EMPTY_PANEL); // fill lower panel with cards for (X509Certificate certificate : original) { addCertificatePanel(certificate); } if (!myCertificates.isEmpty()) { myTreeBuilder.selectFirstCertificate(); } CertificateManager.Config state = CertificateManager.getInstance().getState(); myAcceptAutomatically.setSelected(state.ACCEPT_AUTOMATICALLY); myCheckHostname.setSelected(state.CHECK_HOSTNAME); myCheckValidityPeriod.setSelected(state.CHECK_VALIDITY); }
/** * Sets the JComponent that will be visible in the main window. * * @param component The new jComponent value */ void setJComponent(JComponent component) { mainPanel.removeAll(); if (component != null) { mainPanel.add(component, BorderLayout.CENTER); } getContentPane().validate(); getContentPane().repaint(); }
protected final void showDesignerCard() { myErrorMessages.removeAll(); myErrorStack.setText(null); myLayeredPane.revalidate(); myHorizontalCaption.update(); myVerticalCaption.update(); myLayout.show(this, DESIGNER_CARD); }
public void setConsoleEditorEnabled(boolean consoleEditorEnabled) { if (isConsoleEditorEnabled() == consoleEditorEnabled) return; final FileEditorManagerEx fileManager = FileEditorManagerEx.getInstanceEx(getProject()); if (consoleEditorEnabled) { fileManager.closeFile(myVirtualFile); myPanel.removeAll(); myPanel.add(myHistoryViewer.getComponent()); myPanel.add(myConsoleEditor.getComponent()); myHistoryViewer.setHorizontalScrollbarVisible(false); myCurrentEditor = myConsoleEditor; } else { myPanel.removeAll(); myPanel.add(myHistoryViewer.getComponent(), BorderLayout.CENTER); myHistoryViewer.setHorizontalScrollbarVisible(true); } }
private void swapContainers(Container newContainer) { if (newContainer != null) { swappableContainer.removeAll(); swappableContainer.add(newContainer); swappableContainer.repaint(); swappableContainer.validate(); } }
public void setValue(String key, JComponent value) { JPanel p = keyValueComponentMap.get(key); p.removeAll(); p.add(value); p.add(Box.createHorizontalGlue()); p.repaint(); p.getParent().repaint(); }
public void menu() { if (check == 0) { buttonPanel.removeAll(); buttonPanel.setBounds(width - 200, height - 80, 200, 50); card.next(mainPanel); ctl.setText("- Play -"); buttonPanel.add(back); buttonPanel.add(ctl); menuPanel.savename(); check = 1; secondPanel.musiclist.clearSelection(); gamePanel.setSecond(0); } else if (check == 1) { if (memory[count].getSong() == null) { Container con = getContentPane(); String title = "--Warning--"; String message = "Please Choice a Music Before Playing!"; int type = JOptionPane.WARNING_MESSAGE; JOptionPane.showMessageDialog(con, message, title, type); } else { card.next(mainPanel); secondPanel.clip.stop(); buttonPanel.removeAll(); buttonPanel.setBounds(width - 200, height - 80, 190, 50); ctl.setText("- Stop -"); buttonPanel.add(ctl); buttonPanel.add(exit); check = 2; gamePanel.playmusic(); gamePanel.setRun(true); } } else if (check == 2) { ctl.setText("- Resume -"); gamePanel.clip.stop(); gamePanel.setRun(false); check = 3; } else if (check == 3) { ctl.setText("- Stop -"); gamePanel.clip.start(); gamePanel.setRun(true); check = 2; } }
/** Vlozi obraz figury s obrazkem specifiovanym pic na pozici index. */ public void putFig(int index, int pic) { JPanel panel = (JPanel) figurePan.getComponent(index); if (panel == null || pic < 0 || pic > 3) { return; } panel.removeAll(); panel.add(new JLabel(new ImageIcon(pictures[pic]))); panel.revalidate(); }