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; } }
public void actionPerformed(ActionEvent e) { if (e.getSource() == easy) { invSpeed = 50000; bombN = 1; timeDifficulty1 = 1000; distanceLimit = 400; monsterMultiplier = 1; multiplier = 1; setup(); } else if (e.getSource() == hard) { invSpeed = 30000; bombN = 4; timeDifficulty1 = 500; distanceLimit = 200; monsterMultiplier = 2; multiplier = 2; setup(); } else if (e.getSource() == back) { r = null; menu.setVisible(true); back.setVisible(false); this.revalidate(); repaint(); } else if (e.getSource() == howTo) { menu.removeAll(); menu.add(howToBack); menu.add(howToIMGL); menu.revalidate(); menu.repaint(); } else if (e.getSource() == howToBack) { menu.remove(howToIMGL); menu.remove(howToBack); menu.add(keyboardSpeedL1); menu.add(keyboardSpeedL2); menu.add(easy); menu.add(hard); menu.add(howTo); menu.add(onePlayerRB); menu.add(twoPlayerRB); menu.add(mouseRB); menu.add(keyboardRB); menu.add(keyboardSpeedS1); menu.add(keyboardSpeedS2); menu.add(musicCB); menu.add(highscoreL); menu.add(menuIMGL); menu.revalidate(); menu.repaint(); } }
/** 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(); }
/** 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(); }
private void updateUIWithFindModel() { boolean needToResetSearchFocus = mySearchTextComponent.hasFocus(); boolean needToResetReplaceFocus = myReplaceTextComponent.hasFocus(); updateSearchComponent(); updateReplaceComponent(); if (myFindModel.isReplaceState()) { if (myReplaceFieldWrapper.getParent() == null) { myLeftPanel.add(myReplaceFieldWrapper, BorderLayout.CENTER); } if (myReplaceToolbarWrapper.getParent() == null) { myRightPanel.add(myReplaceToolbarWrapper, BorderLayout.CENTER); } if (needToResetReplaceFocus) { myReplaceTextComponent.requestFocusInWindow(); } } else { if (myReplaceFieldWrapper.getParent() != null) { myLeftPanel.remove(myReplaceFieldWrapper); } if (myReplaceToolbarWrapper.getParent() != null) { myRightPanel.remove(myReplaceToolbarWrapper); } } if (needToResetSearchFocus) mySearchTextComponent.requestFocusInWindow(); mySearchActionsToolbar1.updateActionsImmediately(); mySearchActionsToolbar2.updateActionsImmediately(); myReplaceActionsToolbar1.updateActionsImmediately(); myReplaceActionsToolbar2.updateActionsImmediately(); myReplaceToolbarWrapper.revalidate(); revalidate(); repaint(); myLivePreviewController.setTrackingSelection(!myFindModel.isGlobal()); }
// 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); } }
// Implementation of valueChanged public void valueChanged(ListSelectionEvent e) { if (e.getSource() == table.getSelectionModel()) { ListSelectionModel ls = table.getSelectionModel(); int index = ls.getMinSelectionIndex(); long id = (long) table.getValueAt(index, 0); updateFeesData(id); } else { ListSelectionModel ls = feestable.getSelectionModel(); int index = ls.getMinSelectionIndex(); float feespayed = (float) feestable.getValueAt(index, 1); float totalfees = (float) feestable.getValueAt(index, 2); feespayedlabel.setText("Fees Payed: " + feespayed); totalfeeslabel.setText("Total Fees: " + totalfees); if (totalfees - feespayed > 0) { feesduelabel.setText("Fees Due: " + (totalfees - feespayed)); } panel_6.revalidate(); } }
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(); }
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(); } }
private void setupPanels(@Nullable ProjectTemplate template) { restorePanel(myNamePathComponent, 4); restorePanel(myModulePanel, myWizardContext.isCreatingNewProject() ? 8 : 6); restorePanel(myExpertPanel, myWizardContext.isCreatingNewProject() ? 1 : 0); mySettingsStep = myModuleBuilder == null ? null : myModuleBuilder.modifySettingsStep(this); String description = null; if (template != null) { description = template.getDescription(); if (StringUtil.isNotEmpty(description)) { StringBuilder sb = new StringBuilder("<html><body><font "); sb.append(SystemInfo.isMac ? "" : "face=\"Verdana\" size=\"-1\"").append('>'); sb.append(description).append("</font></body></html>"); description = sb.toString(); myDescriptionPane.setText(description); } } myExpertPlaceholder.setVisible( !(myModuleBuilder instanceof TemplateModuleBuilder) && myExpertPanel.getComponentCount() > 0); for (int i = 0; i < 6; i++) { myModulePanel.getComponent(i).setVisible(!(myModuleBuilder instanceof EmptyModuleBuilder)); } myDescriptionPanel.setVisible(StringUtil.isNotEmpty(description)); mySettingsPanel.revalidate(); mySettingsPanel.repaint(); }
/** 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(); }
private void showStepComponent(final Component component) { String id = myComponentToIdMap.get(component); if (id == null) { id = addStepComponent(component); myContentPanel.revalidate(); myContentPanel.repaint(); } ((CardLayout) myContentPanel.getLayout()).show(myContentPanel, id); }
private void restoreEmptyStatus() { removeAll(); setLayout(new BorderLayout()); add(myRefreshAndInfoPanel, BorderLayout.CENTER); myProgressIcon.suspend(); myRefreshAndInfoPanel.revalidate(); myRefreshAndInfoPanel.repaint(); }
void updateToolbar() { if (myToolbar != null) { myNorthPanel.remove(myToolbar); } myToolbar = createToolbar(); myNorthPanel.add(myToolbar); updateToolbarVisibility(); myContentPane.revalidate(); }
private void selectCompiler(BackendCompiler compiler) { if (compiler == null) { compiler = myDefaultCompiler; } myCompiler.setSelectedItem(compiler); mySelectedCompiler = compiler; myCardLayout.show(myContentPanel, compiler.getId()); myContentPanel.revalidate(); myContentPanel.repaint(); }
private void updateCaretPositionText() { if (myErrorMessage != null) { myCaretPositionLabel.setText( IdeBundle.message("label.scope.editor.caret.position", myCaretPosition + 1)); } else { myCaretPositionLabel.setText(""); } myPositionPanel.setVisible(myErrorMessage != null); myCaretPositionLabel.setVisible(myErrorMessage != null); myPanel.revalidate(); }
private void ensurePresentation() { if (myCurrentHorizontal != myConfiguration.SHORT_DIFF_HORISONTALLY) { final DiffPanel panel = getCurrentPanel(); myPanel.removeAll(); myPanel.add(myTopPanel, BorderLayout.NORTH); myPanel.add(panel.getComponent(), BorderLayout.CENTER); myPanel.revalidate(); myPanel.repaint(); myCurrentHorizontal = myConfiguration.SHORT_DIFF_HORISONTALLY; } }
public void removeElement(PanelElementAbstract b) { int idx = panelElements.indexOf(b); if (idx >= 0) { panelElements.remove(idx); listPanel.remove(b.getPanel()); listLayout.setRows(Math.max(panelElements.size() + 1, minNbRows)); listPanel.revalidate(); listPanel.repaint(); setAddButtonColor(); if (ml != null) b.unRegister(ml); for (int i = idx; i < panelElements.size(); i++) panelElements.get(i).setIdx(idx); } }
private void initButtonPanel() { final Parser p = InterfaceConfig.SELECTION_FRAME_PROPERTIES; back.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { state.back(); } }); back.setText(p.getString("back-button")); next.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { state.next(); } }); next.setText(p.getString("next-button-next")); config.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { JDialog d = loaders.get(plugins.getSelectedIndex()).getConfigDialog(SelectionFrame.this); d.setLocationByPlatform(true); d.setModal(true); d.setVisible(true); } }); JButton manual = new JButton(p.getString("manual-button")); manual.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { MainFrame.showHelp( state.getManualTile(), p.getInt("manual-width"), p.getInt("manual-height"), p.getInt("manual-deltaX"), p.getInt("manual-deltaY"), state.getManualURL(), SelectionFrame.this); } }); config.setText(p.getString("config-button")); buttonPanel.add(back); buttonPanel.add(manual); buttonPanel.add(config); buttonPanel.add(next); buttonPanel.revalidate(); }
private void setToComponent(final JComponent cmp, final boolean requestFocus) { myMatchingCountPanel.removeAll(); myMatchingCountPanel.add(cmp, BorderLayout.CENTER); myMatchingCountPanel.revalidate(); myMatchingCountPanel.repaint(); if (requestFocus) { SwingUtilities.invokeLater( new Runnable() { public void run() { myPatternField.getTextField().requestFocusInWindow(); } }); } }
public void edit(InitVariableAction var) { variable = var; if (editor != null) varEditPane.remove((EditorPanel) editor); var.addVariableListener(variableListener); editor = var.getVariableEditor(); varName.setText(var.getName()); varName.repaint(); if (editor != null) { editor.edit(var.getNewInitialization()); varEditPane.add((EditorPanel) editor, BorderLayout.CENTER); varEditPane.revalidate(); varEditPane.repaint(); } }
private void updateTextFieldShowing() { myTextFieldAction.update(); myNorthPanel.remove(myPathTextFieldWrapper); if (isToShowTextField()) { final ArrayList<VirtualFile> selection = new ArrayList<VirtualFile>(); if (myFileSystemTree.getSelectedFile() != null) { selection.add(myFileSystemTree.getSelectedFile()); } updatePathFromTree(selection, true); myNorthPanel.add(myPathTextFieldWrapper, BorderLayout.CENTER); } else { setErrorText(null); } myPathTextField.getField().requestFocus(); myNorthPanel.revalidate(); myNorthPanel.repaint(); }
private void viewReport() throws Exception { Date fromDate = fromDatePicker.getDate(); Date toDate = toDatePicker.getDate(); if (fromDate.after(toDate)) { POSMessageDialog.showError( BackOfficeWindow.getInstance(), com.floreantpos.POSConstants.FROM_DATE_CANNOT_BE_GREATER_THAN_TO_DATE_); return; } fromDate = DateUtil.startOfDay(fromDate); toDate = DateUtil.endOfDay(toDate); ReportService reportService = new ReportService(); CreditCardReport report = reportService.getCreditCardReport(fromDate, toDate); HashMap<String, Object> map = new HashMap<String, Object>(); ReportUtil.populateRestaurantProperties(map); map.put( "reportTitle", "========= " + Messages.getString("PosMessage.142").toUpperCase() + " =========="); map.put("fromDate", ReportService.formatShortDate(fromDate)); map.put("toDate", ReportService.formatShortDate(toDate)); map.put("reportTime", ReportService.formatFullDate(new Date())); map.put("salesCount", String.valueOf(report.getTotalSalesCount())); map.put("totalSales", NumberUtil.formatNumber(report.getTotalSales())); map.put("netTips", NumberUtil.formatNumber(report.getNetTips())); map.put("netTipsPaid", NumberUtil.formatNumber(report.getTipsPaid())); map.put("netCharge", NumberUtil.formatNumber(report.getNetCharge())); JasperReport jasperReport = (JasperReport) JRLoader.loadObject( getClass().getResource("/com/floreantpos/ui/report/credit_card_report.jasper")); JasperPrint jasperPrint = JasperFillManager.fillReport( jasperReport, map, new JRTableModelDataSource(report.getTableModel())); JRViewer viewer = new JRViewer(jasperPrint); reportContainer.removeAll(); reportContainer.add(viewer); reportContainer.revalidate(); }
/** Update any UI elements from the model (hint that data has changed). */ public void updateFromModel() { if (ColorAndFontConstants.isInverse()) { inactiveBackGroundColor = new Color( Math.min(255, Themes.currentTheme.detailPanelBackground().getRed() + 2 * COLOR_DELTA), Math.min( 255, Themes.currentTheme.detailPanelBackground().getBlue() + 2 * COLOR_DELTA), Math.min( 255, Themes.currentTheme.detailPanelBackground().getGreen() + 2 * COLOR_DELTA)); } else { inactiveBackGroundColor = new Color( Math.max(0, Themes.currentTheme.detailPanelBackground().getRed() - COLOR_DELTA), Math.max(0, Themes.currentTheme.detailPanelBackground().getBlue() - COLOR_DELTA), Math.max(0, Themes.currentTheme.detailPanelBackground().getGreen() - COLOR_DELTA)); } panelMain.invalidate(); panelMain.revalidate(); panelMain.repaint(); }
public boolean closeDialog(DialogTab dialogTab) { for (int i = 0; i < dialogTabArrayList.size(); i++) { if (dialogTabArrayList.get(i).equals(dialogTab)) { dialogPanelArrayList.remove(i); dialogTabArrayList.remove(i); if (!(currentDialogPanel == null)) currentDialogPanel.setVisible(false); if (dialogTabArrayList.size() == 0) { dialogTabsPanel.setVisible(false); currentDialogTab = null; currentDialogPanel = null; repaint(); revalidate(); return true; } if ((dialogTab.equals(currentDialogTab))) { if (i > 0) { currentDialogPanel = dialogPanelArrayList.get(i - 1); currentDialogTab = dialogTabArrayList.get(i - 1); } else { currentDialogPanel = dialogPanelArrayList.get(i); currentDialogTab = dialogTabArrayList.get(i); } } if (!(currentDialogPanel == null)) { currentDialogTab.setBorder(new LineBorder(Color.RED)); currentDialogPanel.setBounds(0, 84, 960, 1000); bigPanel.add(currentDialogPanel); currentDialogPanel.setVisible(true); } dialogTabsPanel.setVisible(false); if (dialogTabArrayList.size() > 0) repaintDialogTabsPanel(); bigPanel.repaint(); bigPanel.revalidate(); break; } } return false; }
protected void addElement(BasicDBObject DBO, int idx) { try { PanelElementAbstract b = createPanelElement(DBO, idx); if (ml != null) b.register(ml); panelElements.add(b); if (template != null) { if (template.panelElements.size() > idx) { if (b instanceof PanelElementPlugin) ((PanelElementPlugin) b) .setTemplate((PanelElementPlugin) template.panelElements.get(idx)); } } listPanel.add(b.getPanel()); listLayout.setRows(Math.max(panelElements.size() + 1, minNbRows)); listPanel.revalidate(); // scrollPane.getViewport().revalidate(); panelDisplayer.refreshDisplay(); setAddButtonColor(); } catch (Exception e) { exceptionPrinter.print(e, "", Core.GUIMode); } }
void tableInitialise(JTable table) { JScrollPane scroll; TableColumn column = null; int colunms = table.getColumnCount(); for (int y = 0; y < colunms; y++) { column = table.getColumnModel().getColumn(y); /*将每一列的默认宽度设置为100*/ column.setPreferredWidth(100); } /* * 设置JTable自动调整列表的状态,此处设置为关闭 */ table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); table.setFont(new Font("Menu.font", Font.PLAIN, 14)); table.getTableHeader().setFont(new Font("Menu.font", Font.BOLD, 15)); /*用JScrollPane装载JTable,这样超出范围的列就可以通过滚动条来查看*/ scroll = new JScrollPane(table); TablePanel.removeAll(); TablePanel.setLayout(new BoxLayout(TablePanel, BoxLayout.Y_AXIS)); TablePanel.add(scroll); TablePanel.revalidate(); table.setRowSelectionAllowed(true); // 设置JTable可被选择 table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // 设置JTable为单行选择 table.getTableHeader().setBackground(new Color(206, 231, 255)); // 设置JTable表头颜色 table.getTableHeader().setReorderingAllowed(false); // 设置JTable每个字段的顺序不可以改变 table.getTableHeader().setResizingAllowed(false); // 设置JTable每个表头的大小不可以改变 makeFace(table); // 设置JTable 颜色 table.setVisible(true); }
public void friendPanelMode() { if (isFriendPanelOpened) { friendPanelButton.addMouseListener( new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { friendPanelButton.setIcon(friendSideCloseIconEntered); } @Override public void mouseExited(MouseEvent e) { friendPanelButton.setIcon(friendSideCloseIcon); } }); friendPanelButton.setIcon(friendSideCloseIcon); setSize(1300, 610); } else { setSize(960, 610); friendPanelButton.setIcon(friendSideOpenIcon); friendPanelButton.addMouseListener( new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { friendPanelButton.setIcon(friendSideOpenIconEntered); } @Override public void mouseExited(MouseEvent e) { friendPanelButton.setIcon(friendSideOpenIcon); } }); } bigPanel.revalidate(); bigPanel.repaint(); bigPanel.updateUI(); }
private void buildInInlineIndicator(@NotNull final InlineProgressIndicator inline) { removeAll(); setLayout(new InlineLayout()); add(myRefreshAndInfoPanel); final JPanel inlinePanel = new JPanel(new BorderLayout()); inline.getComponent().setBorder(new EmptyBorder(1, 0, 0, 2)); final JComponent inlineComponent = inline.getComponent(); inlineComponent.setOpaque(false); inlinePanel.add(inlineComponent, BorderLayout.CENTER); // myProgressIcon.setBorder(new IdeStatusBarImpl.MacStatusBarWidgetBorder()); inlinePanel.add(myProgressIcon, BorderLayout.WEST); inline.updateProgressNow(); inlinePanel.setOpaque(false); add(inlinePanel); myRefreshAndInfoPanel.revalidate(); myRefreshAndInfoPanel.repaint(); if (UISettings.getInstance().PRESENTATION_MODE) { final JRootPane pane = myInfoPanel.getRootPane(); final RelativePoint point = new RelativePoint(pane, new Point(pane.getWidth() - 250, 60)); final PresentationModeProgressPanel panel = new PresentationModeProgressPanel(inline); final MyInlineProgressIndicator delegate = new MyInlineProgressIndicator(true, inline.getInfo(), inline) { @Override protected void updateProgress() { super.updateProgress(); panel.update(); } }; Disposer.register(inline, delegate); JBPopupFactory.getInstance() .createBalloonBuilder(panel.getRootPanel()) .setFadeoutTime(0) .setFillColor(Gray.TRANSPARENT) .setShowCallout(false) .setBorderColor(Gray.TRANSPARENT) .setBorderInsets(new Insets(0, 0, 0, 0)) .setAnimationCycle(0) .setCloseButtonEnabled(false) .setHideOnClickOutside(false) .setDisposable(inline) .setHideOnFrameResize(false) .setHideOnKeyOutside(false) .setBlockClicksThroughBalloon(true) .setHideOnAction(false) .createBalloon() .show( new PositionTracker<Balloon>(pane) { @Override public RelativePoint recalculateLocation(Balloon object) { final EditorComponentImpl editorComponent = UIUtil.findComponentOfType(pane, EditorComponentImpl.class); if (editorComponent != null) { return new RelativePoint( editorComponent.getParent().getParent(), new Point( editorComponent.getParent().getParent().getWidth() - 150, editorComponent.getParent().getParent().getHeight() - 70)); } return point; } }, Balloon.Position.above); } }
/** Remove all panel content. */ public final void clearData() { innerPanel.removeAll(); innerPanel.revalidate(); innerPanel.repaint(); filters.clear(); }