/** * Creates the {@link JPanel} showing the mission time. * * @param maxwidth * the dimension of the longest label * @return the JPanel showing the mission time */ private JPanel createMtPanel(Dimension maxwidth) { Double mtVal = inverse.evaluate(reliabilityFunction, standardMT); JLabel pmtLabel = new JLabel("P[MT] ="); pmtLabel.setMinimumSize(maxwidth); JLabel mtLabel = new JLabel("MT:"); mtLabel.setMinimumSize(maxwidth); mtProbability = new JFormattedTextField(mtFieldFormat); mtProbability.addActionListener(MeasurePanel.this); mtProbability.setPreferredSize(new Dimension(70, 15)); mtProbability.setHorizontalAlignment(SwingConstants.RIGHT); mtProbability.setText(standardMT.toString()); mt = new JLabel(mtVal.toString()); return createSubPanel("Mission-Time", pmtLabel, mtProbability, mtLabel, mt); }
public void update() { rows = datasetGenerator.getGCActivityNum(); labels = new JLabel[rows][columns]; for (int r = 0; r < rows; ++r) { String gcActivityName = datasetGenerator.getGCActivityName(r); JLabel label = GUIUtilities.createJLabelForTable(gcActivityName); GUIUtilities.setTableHeader(label); labels[r][0] = label; for (int c = 1; c < columns; ++c) { label = GUIUtilities.createJLabelForTable(); label.setHorizontalAlignment(SwingConstants.RIGHT); labels[r][c] = label; } } }
@Override public TableCellRenderer getTableCellRenderer(Engine engine, AccessRules rules, Attribute attribute) { return new DefaultTableCellRenderer() { /** * */ private static final long serialVersionUID = -7922052040779840252L; { setHorizontalAlignment(SwingConstants.RIGHT); } @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Component component = super.getTableCellRendererComponent( table, value, isSelected, hasFocus, row, column); if (value != null) ((JLabel) component).setText(format(value)); return component; } }; }
/** * This SavePanel creates delete and load buttons * * @param gui */ public LoadDelete(GUI gui){ this.setLayout(new BorderLayout()); filename = new JLabel("test"); filename.setHorizontalAlignment(SwingConstants.CENTER); this.add(filename, BorderLayout.PAGE_START); JButton delete = new JButton("DELETE"); delete.addActionListener(new Listeners.Delete(gui)); this.add(delete, BorderLayout.LINE_END); JButton loadAll = new JButton("LOAD ALL"); loadAll.addActionListener(new Listeners.LoadAll(gui)); this.add(loadAll, BorderLayout.LINE_START); }
protected void initComponents() { if (!oPanel.isPrepared()) { initComponent = new JLabel(NbBundle.getMessage(InitPanel.class, "LBL_computing")); // NOI18N initComponent.setPreferredSize(new Dimension(850, 450)); // avoid flicking ? Color c = UIManager.getColor("Tree.background"); // NOI18N if (c == null) { //GTK 1.4.2 will return null for Tree.background c = Color.WHITE; } initComponent.setBackground(c); // NOI18N initComponent.setHorizontalAlignment(SwingConstants.CENTER); initComponent.setOpaque(true); CardLayout card = new CardLayout(); setLayout(card); add(initComponent, "init"); // NOI18N card.show(this, "init"); // NOI18N Utilities.attachInitJob(this, this); } else { finished(); } }
/** * Helper method used to create a button inside a JPanel * @param action action associated to that button * @return created component */ private JComponent createButton(AbstractAction action) { JPanel panel = new JPanel(); // Use gridbag as centers by default JButton button = new JButton(action); button.setHorizontalTextPosition(SwingConstants.CENTER); button.setVerticalTextPosition(SwingConstants.BOTTOM); button.setPreferredSize(new Dimension((int) (BUTTONSIZE * 3.5), (BUTTONSIZE * 2))); button.addMouseListener(rollover); //if (action == buttonAction[4]) { // button.setVisible(false); //} //if (action == buttonAction[0]) { // button.setEnabled(false); //} //if(action == buttonAction[2]) button.setEnabled(false); //if(action == buttonAction[4]) button.setEnabled(false); panel.add(button); return panel; }
public static void testFixedScenarios(RandomTestContainer container) throws Exception { // Fixed scenario - last undo throwed exc. RandomTestContainer.Context gContext = container.context(); JEditorPane pane = EditorPaneTesting.getEditorPane(container); // Insert initial text into doc // DocumentTesting.insert(container.context(), 0, "abc\ndef\n\nghi"); DocumentTesting.insert(gContext, 0, "\n\n\n\n\n"); DocumentTesting.remove(gContext, 0, DocumentTesting.getDocument(gContext).getLength()); // Check for an error caused by delete a line-2-begining and insert at line-1-end and two undos DocumentTesting.insert(gContext, 0, "a\nb\n\n"); EditorPaneTesting.setCaretOffset(gContext, 2); EditorPaneTesting.performAction(gContext, pane, DefaultEditorKit.deleteNextCharAction); EditorPaneTesting.moveOrSelect(gContext, SwingConstants.WEST, false); // Should go to end of first line EditorPaneTesting.typeChar(gContext, 'c'); DocumentTesting.undo(gContext, 1); DocumentTesting.undo(gContext, 1); // This throwed ISE for plain text mime type }
/** * The original getCellRenderer method is overwritten, since the table * displays in red the values of the selected class * @param row the row of the cell * @param column the column of the cell * @return a the TableCellRenderer for the requested cell (row,column) */ @Override public TableCellRenderer getCellRenderer(int row, int column) { dtcr.setHorizontalAlignment(SwingConstants.CENTER); Component c; if (column < cd.getClosedClassKeys().size()) { Vector closedClasses = cd.getClosedClassKeys(); Object thisClass = closedClasses.get(column); int thisPop = cd.getClassPopulation(thisClass).intValue(); c = dtcr.getTableCellRendererComponent(this, Integer.toString(thisPop), false, false, row, column); if (NCPA.isSingleClass()) { if (thisClass == NCPA.getReferenceClass()) { c.setForeground(Color.RED); } else { c.setForeground(Color.BLACK); } } else { c.setForeground(Color.RED); } } else { c = dtcr.getTableCellRendererComponent(this, "-", false, false, row, column); c.setForeground(Color.BLACK); } ((JLabel) c).setToolTipText(cd.getClassName(cd.getClosedClassKeys().get(column))); return dtcr; }
/** * @return the logo of the contributor company */ public JComponent getLogo() { switch (this) { case POLIMI: JLabel logo = new JLabel(GraphStartScreen.HTML_POLI); logo.setHorizontalTextPosition(SwingConstants.TRAILING); logo.setVerticalTextPosition(SwingConstants.CENTER); logo.setIconTextGap(10); logo.setIcon(JMTImageLoader.loadImage("logo", new Dimension(70, 70))); return logo; case ICL: return new JLabel(JMTImageLoader.loadImage("logo_icl", new Dimension(-1,40))); default: return null; } }
private void init() { setBackground(new Color(0, 0, 0, 0)); setOpaque(false); JLabel modelo = new JLabel() { @Override public String toString() { return hero.getToString(); } }; modelo.setBackground(new Color(0, 0, 0, 0)); modelo.setHorizontalAlignment(SwingConstants.CENTER); modelo.setIcon(Images.ARENA_HEROI); add(hero.getPanelHeroi(), AbsolutesConstraints.HEROI_PANEL_IMAGEM, 0); add(modelo, AbsolutesConstraints.ZERO, 0); add(hero.getPanelAtaque(), AbsolutesConstraints.HEROI_PANEL_ATAQUE, 0); add(hero.getPanelEscudo(), AbsolutesConstraints.HEROI_PANEL_SHIELD, 0); add(hero.getPanelVida(), AbsolutesConstraints.HEROI_PANEL_VIDA, 0); add(hero.getPanelPoder(), AbsolutesConstraints.HEROI_PANEL_PODER, 0); add(hero.getPanelArma(), AbsolutesConstraints.HEROI_PANEL_ARMA, 0); add(hero.getPanelSegredo(), AbsolutesConstraints.HEROI_PANEL_SEGREDO, 0); add(hero.getPanelDanoMagico(), AbsolutesConstraints.HEROI_PANEL_DANO_MAGICO, 0); }
@Override public void propertyChange(PropertyChangeEvent evt) { if (NbMavenProject.PROP_PROJECT.equals(evt.getPropertyName())) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { if (panel != null && panel.isVisible()) { panel.add(new JLabel(LBL_loading_Eff(), SwingConstants.CENTER), BorderLayout.CENTER); task.schedule(0); } else { firstTimeShown = true; } } }); } }
/** * Set up the panel contents and layout */ protected void initComponents() { table = new ResultsTable(getTableModel(), help); table.setRowHeight(CommonConstants.ROW_HEIGHT); statusLabel.setForeground(Color.RED); statusLabel.setFont(new Font("Arial", Font.BOLD, 14)); statusLabel.setText("WARNING: parameters have been changed since this solution was computed!"); statusLabel.setHorizontalAlignment(SwingConstants.CENTER); help.addHelp(statusLabel, "This solution is not current with the parameters of the model. Click solve to compute a new solution."); JPanel intPanel = new JPanel(new BorderLayout(10, 10)); JScrollPane jsp = new JScrollPane(table, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); JLabel descrLabel = new JLabel(getDescriptionMessage()); intPanel.add(descrLabel, BorderLayout.NORTH); intPanel.add(jsp, BorderLayout.CENTER); setLayout(new BorderLayout()); add(intPanel, BorderLayout.CENTER); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); }
/** * Draws the component border. * * @param graphics * the graphics context */ void paintBorder(Graphics graphics) { Graphics2D g = (Graphics2D) graphics.create(); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setColor(Colors.BUTTON_BORDER); int radius = RapidLookAndFeel.CORNER_DEFAULT_RADIUS; switch (position) { case SwingConstants.LEFT: g.drawRoundRect(0, 0, button.getWidth() + radius, button.getHeight() - 1, radius, radius); break; case SwingConstants.CENTER: g.drawRect(0, 0, button.getWidth() + radius, button.getHeight() - 1); break; default: g.drawRoundRect(-radius, 0, button.getWidth() + radius - 1, button.getHeight() - 1, radius, radius); g.drawLine(0, 0, 0, button.getHeight()); break; } }
private void installLabels(JScrollPane scrollPane) { moreColumnsLabel.setIcon(JMTImageLoader.loadImage("table_rightarrow")); moreColumnsLabel.setHorizontalAlignment(SwingConstants.CENTER); moreColumnsLabel.setToolTipText(moreColumnsTooltip); moreColumnsLabel.setVisible(false); moreRowsLabel.setIcon(JMTImageLoader.loadImage("table_downarrow")); moreRowsLabel.setHorizontalAlignment(SwingConstants.CENTER); moreRowsLabel.setToolTipText(moreRowsTooltip); moreRowsLabel.setVisible(false); scrollPane.setCorner(ScrollPaneConstants.UPPER_RIGHT_CORNER, moreColumnsLabel); scrollPane.setCorner(ScrollPaneConstants.LOWER_LEFT_CORNER, moreRowsLabel); if (displaysScrollLabels) { updateScrollLabels(); } }
public InformationFrame() { setType(Type.POPUP); setResizable(false); setModalExclusionType(ModalExclusionType.APPLICATION_EXCLUDE); this.setTitle("Approving question"); this.setPreferredSize(new Dimension(350, 170)); this.setAlwaysOnTop(isAlwaysOnTopSupported()); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); getContentPane().setLayout(new BorderLayout()); final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); this.setLocation(screenSize.width / 2 - 150, screenSize.height / 2 - 75); this.setIconImage(Toolkit.getDefaultToolkit().getImage(InformationFrame.class.getResource(LOGOPATH))); final JPanel panel = new JPanel(); getContentPane().add(panel, BorderLayout.CENTER); panel.setLayout(null); okBtn = new JButton("OK"); okBtn.setIcon(new ImageIcon(InformationFrame.class.getResource("/com/coder/hms/icons/info_ok.png"))); okBtn.setFont(new Font("Lucida Grande", Font.PLAIN, 15)); okBtn.setBorder(new SoftBevelBorder(BevelBorder.RAISED, null, null, null, null)); okBtn.setBounds(119, 102, 132, 35); okBtn.addActionListener(getAction()); panel.add(okBtn); lblMessage = new JLabel(""); lblMessage.setHorizontalTextPosition(SwingConstants.CENTER); lblMessage.setHorizontalAlignment(SwingConstants.LEFT); lblMessage.setBounds(87, 21, 246, 74); panel.add(lblMessage); lblIcon = new JLabel(""); lblIcon.setIcon(new ImageIcon(InformationFrame.class.getResource("/com/coder/hms/icons/dialogPane_question.png"))); lblIcon.setBounds(6, 36, 69, 70); panel.add(lblIcon); this.pack(); }
/** * Creates the panel to be shown when the table is empty * @param msg message to be shown on the panel * @return created warning panel */ protected JPanel createWarningPanel(String msg) { JPanel warning = new JPanel(new GridBagLayout()); JPanel innerPanel = new JPanel(new BorderLayout()); // Adds image JLabel icon = new JLabel(""); icon.setIcon(JMTImageLoader.loadImage("Triangle")); icon.setHorizontalAlignment(SwingConstants.CENTER); icon.setBorder(BorderFactory.createEmptyBorder(BORDERSIZE, BORDERSIZE, BORDERSIZE, BORDERSIZE)); innerPanel.add(icon, BorderLayout.NORTH); // Adds Text Area JTextArea text = new JTextArea(); text.setEditable(false); text.setWrapStyleWord(true); text.setLineWrap(true); text.setText(msg); text.setBorder(BorderFactory.createEmptyBorder(BORDERSIZE, BORDERSIZE, BORDERSIZE, BORDERSIZE)); text.setBackground(icon.getBackground()); innerPanel.add(text, BorderLayout.CENTER); innerPanel.setBorder(BorderFactory.createEtchedBorder()); innerPanel.setPreferredSize(warningBoxSize); warning.add(innerPanel); return warning; }
/** * */ private JPanel setUpControls() { JPanel jp = new JPanel(); jp.setBackground(Color.WHITE); jp.setLayout(new BoxLayout(jp, BoxLayout.PAGE_AXIS)); jp.setBorder(BorderFactory.createLineBorder(Color.black, 3)); jp.add( new JLabel("Select a pair of vertices for which a shortest path will be displayed")); JPanel jp2 = new JPanel(); jp2.add(new JLabel("vertex from", SwingConstants.LEFT)); jp2.add(getSelectionBox(true)); jp2.setBackground(Color.white); JPanel jp3 = new JPanel(); jp3.add(new JLabel("vertex to", SwingConstants.LEFT)); jp3.add(getSelectionBox(false)); jp3.setBackground(Color.white); jp.add( jp2 ); jp.add( jp3 ); return jp; }
/** * */ public void updateActionPane() { actions.removeAll(); try { posActions = Main.guiControlller.getPossibleActions(); String actionName; int i = 0; for (Action<?> posAction : posActions) { actionName = posAction.toString(); JButton b1 = new JButton(actionName); b1.setHorizontalAlignment(SwingConstants.LEFT); b1.addActionListener(this); b1.setActionCommand(Integer.toString(i)); b1.setMaximumSize(new Dimension(Integer.MAX_VALUE, b1.getMinimumSize().height)); actions.add(b1); i++; } actions.revalidate(); actions.repaint(); this.repaint(); } catch (Exception e) { Main.updateUserMsg(e.getMessage()); } }
/** * Initializes GUI. */ private void initGUI() { CalcLayout pane = new CalcLayout(5); JPanel p = new JPanel(pane); display = new JLabel("0", SwingConstants.RIGHT); display.setMinimumSize(new Dimension(75, 75)); display.setVerticalAlignment(SwingConstants.BOTTOM); display.setBackground(Color.WHITE); display.setOpaque(false); display.setFont(new Font(display.getFont().toString(), Font.BOLD, 30)); p.add(display, new RCPosition(1, 1)); addNumberButtons(p); addOperatorButtons(p); addFunctionButtons(p); addControlButtons(p); getContentPane().add(p); }
void jbInit() throws Exception { this.setResizable(false); this.setIconImage(new ImageIcon(PopupDesktopNotification.class.getResource("/ui/icons/jnotes16.png")).getImage()); this.getContentPane().setBackground(ColorMap.POPBG); border2 = BorderFactory.createEmptyBorder(0,30,0,30); border3 = BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(Color.white,ColorMap.POPBG),BorderFactory.createEmptyBorder(0,30,0,30)); border4 = BorderFactory.createEmptyBorder(10,10,0,10); panel1.setLayout(borderLayout1); panel1.setBackground(ColorMap.POPBG); jButton1.setText(Local.getString("Ok")); jButton1.setBounds(150, 415, 95, 30); jButton1.setPreferredSize(new Dimension(95, 30)); jButton1.setBackground(ColorMap.OKBNBG); jButton1.setForeground(ColorMap.OKBNFG); jButton1.setDefaultCapable(true); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { jButton1_actionPerformed(e); } }); panel1.setBorder(border4); panel1.setMinimumSize(new Dimension(300, 200)); panel1.setPreferredSize(new Dimension(300, 200)); timeLabel.setFont(new java.awt.Font("Dialog", 0, 20)); timeLabel.setHorizontalAlignment(SwingConstants.CENTER); textLabel.setHorizontalAlignment(SwingConstants.CENTER); getContentPane().add(panel1); panel1.add(jPanel1, BorderLayout.SOUTH); jPanel1.add(jButton1, null); jPanel1.setBackground(ColorMap.POPBG); panel1.add(textLabel, BorderLayout.CENTER); panel1.add(timeLabel, BorderLayout.NORTH); playSoundNotification(); }
void currentDateChanged(CalendarDate newdate) { Cursor cur = App.getFrame().getCursor(); App.getFrame().setCursor(waitCursor); if (!changedByHistory) { History.add(new HistoryItem(newdate, CurrentProject.get())); } if (!dateChangedByCalendar) { calendarIgnoreChange = true; calendar.set(newdate); calendarIgnoreChange = false; } /*if ((currentNote != null) && !changedByHistory && !addedToHistory) History.add(new HistoryItem(currentNote));*/ currentNoteChanged(currentNote,true); currentNote = CurrentProject.getNoteList().getNoteForDate(newdate); CurrentNote.set(currentNote,true); currentDate = CurrentDate.get(); /*addedToHistory = false; if (!changedByHistory) { if (currentNote != null) { History.add(new HistoryItem(currentNote)); addedToHistory = true; } }*/ currentDateLabel.setText(newdate.getFullDateString()); if ((currentNote != null) && (currentNote.isMarked())) { currentDateLabel.setIcon(bookmarkIcon); currentDateLabel.setHorizontalTextPosition(SwingConstants.LEFT); } else { currentDateLabel.setIcon(null); } updateIndicators(newdate, CurrentProject.getTaskList()); App.getFrame().setCursor(cur); }
public ExtendedTableCellRenderer(Color objPforegroundColor, Color objPbackgroundColor) { this.setHorizontalAlignment(SwingConstants.CENTER); this.setVerticalAlignment(SwingConstants.CENTER); this.setFont(new Font("Courier", Font.PLAIN, 10)); this.setForeground(objPforegroundColor); this.setBackground(objPbackgroundColor); }
/** * Initialize the contents of the frame. */ private void initialize() { frame = new JFrame("Library Book Loan System - All Users"); frame.setResizable(false); frame.setBounds(100, 100, 588, 400); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); JPanel panel = new JPanel(); frame.getContentPane().add(panel, BorderLayout.CENTER); panel.setLayout(null); JLabel lblAllBooks = new JLabel("All Users"); lblAllBooks.setHorizontalAlignment(SwingConstants.CENTER); lblAllBooks.setFont(new Font("Segoe UI Light", Font.PLAIN, 14)); lblAllBooks.setBounds(10, 40, 564, 22); panel.add(lblAllBooks); JLabel label_1 = new JLabel("Library Book Loan System"); label_1.setHorizontalAlignment(SwingConstants.CENTER); label_1.setFont(new Font("Segoe UI Light", Font.PLAIN, 18)); label_1.setBounds(10, 11, 564, 25); panel.add(label_1); JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(10, 73, 564, 257); panel.add(scrollPane); Object columnNames[] = { "Username", "Email", "User Role"}; DefaultTableModel model = new DefaultTableModel(1, columnNames.length); model.setColumnIdentifiers(columnNames); table = new JTable(model) { @Override public boolean isCellEditable(int row, int column) { return false; } }; scrollPane.setViewportView(table); List<User> userList = UserController.getInstance().getAllUsers(); ((DefaultTableModel) table.getModel()).removeRow(0); for (User user : userList) { ((DefaultTableModel) table.getModel()).addRow( new Object[]{user.getUsername(), user.getEmail(), user.getRole().toString()}); } JLabel lblBooks = new JLabel(userList.size() + " User(s)"); lblBooks.setBounds(528, 336, 46, 14); panel.add(lblBooks); }
private int preferredHeaderWidth() { final JLabel longestRowLabel = new JLabel("1.1.1"); final JTableHeader header = table.getTableHeader(); longestRowLabel.setBorder(header.getBorder()); longestRowLabel.setHorizontalAlignment(SwingConstants.CENTER); longestRowLabel.setFont(header.getFont()); return longestRowLabel.getPreferredSize().width; }
/** Creates a new instance of RecentProjects */ public ShowNextTime() { super( new BorderLayout() ); setOpaque(false); button = new JCheckBox( BundleSupport.getLabel( "ShowOnStartup" ) ); // NOI18N button.setSelected( WelcomeOptions.getDefault().isShowOnStartup() ); button.setOpaque( false ); button.setForeground( Color.white ); button.setHorizontalTextPosition( SwingConstants.LEFT ); BundleSupport.setAccessibilityProperties( button, "ShowOnStartup" ); //NOI18N add( button, BorderLayout.CENTER ); button.addActionListener( this ); }
private JButton createButton(String name, ActionListener listener) { JButton button = new JButton(name); button.setMargin(new Insets(0, 0, 0, 0)); button.setOpaque(false); button.setHorizontalAlignment(SwingConstants.LEADING); button.setForeground(Utility.LINK_COLOR); button.setBorder(Utility.LEFTCELLBORDER); button.addActionListener(listener); return button; }
private void init(){ setOpaque(false); shield = new JLabelAtributos(heroi, JLabelAtributos.SHIELD); background = new JLabel(Images.HEROI_ESCUDO, SwingConstants.CENTER); add(shield, AbsolutesConstraints.HEROI_LABEL_ESCUDO); add(background, new AbsoluteConstraints(0, 0, 70, 70)); setVisible(heroi.getShield() > 0); }
/** * Try to keep the viewport aligned on column boundaries in the direction of interest */ @Override public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { if (orientation == SwingConstants.HORIZONTAL) { return 80; } return getRowHeight(); }
@Override public int getScrollableBlockIncrement( Rectangle visible, int orientation, int direction) { switch (orientation) { case SwingConstants.HORIZONTAL: return visible.width * 100 / 100; case SwingConstants.VERTICAL: return visible.height * 100 / 100; default: throw new IllegalArgumentException("Invalid orientation: " + orientation); //NOI18N } }
public NoTopicEditor(String message) { JLabel messageLabel = new JLabel(CurrentLocale.get(getKey("notopic.") + message)); messageLabel.setHorizontalAlignment(SwingConstants.CENTER); setLayout(new GridLayout(1, 1)); add(messageLabel); }
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { if( orientation == SwingConstants.VERTICAL) return 10; int newX = visibleRect.x + (direction>0 ? 10 : -10); if( wrap>0. ) { int dx = (int) (wrap*zoom); int test = getPreferredSize().width - visibleRect.width; while( newX<0 ) newX += dx; while( newX>test ) newX -= dx; } return (direction>0) ? (newX-visibleRect.x) : -(newX-visibleRect.x); }
private void addLoadingLabel() { editor.setLayout(new BorderLayout()); loadingLabel = new JLabel(NbBundle.getMessage(CloneableEditor.class, "LBL_EditorLoading")); // NOI18N loadingLabel.setOpaque(true); loadingLabel.setHorizontalAlignment(SwingConstants.CENTER); loadingLabel.setBorder(new EmptyBorder(new Insets(11, 11, 11, 11))); loadingLabel.setVisible(false); editor.add(loadingLabel, BorderLayout.CENTER); }
void currentDateChanged(CalendarDate newdate) { Cursor cur = App.getFrame().getCursor(); App.getFrame().setCursor(waitCursor); if (!changedByHistory) { History.add(new HistoryItem(newdate, CurrentProject.get())); } if (!dateChangedByCalendar) { calendarIgnoreChange = true; calendar.set(newdate); calendarIgnoreChange = false; } /*if ((currentNote != null) && !changedByHistory && !addedToHistory) History.add(new HistoryItem(currentNote));*/ currentNoteChanged(currentNote,true); currentNote = CurrentProject.getNoteList().getNoteForDate(newdate); CurrentNote.set(currentNote,true); currentDate = CurrentDate.get(); /*addedToHistory = false; if (!changedByHistory) { if (currentNote != null) { History.add(new HistoryItem(currentNote)); addedToHistory = true; } }*/ currentDateLabel.setText(newdate.getFullDateString()); updateFullDateFormat();//Test if ((currentNote != null) && (currentNote.isMarked())) { currentDateLabel.setIcon(bookmarkIcon); currentDateLabel.setHorizontalTextPosition(SwingConstants.LEFT); } else { currentDateLabel.setIcon(null); } updateIndicators(newdate, CurrentProject.getTaskList()); App.getFrame().setCursor(cur); }
public JProgressDemo() { frame = new JFrame("install"); frame.setLayout(new BorderLayout()); label = new JLabel("progress",SwingConstants.CENTER); progressbar = new JProgressBar(); progressbar.setOrientation(JProgressBar.HORIZONTAL); progressbar.setMinimum(0); progressbar.setMaximum(100); progressbar.setValue(0); //progressbar.setStringPainted(true); progressbar.addChangeListener(this); progressbar.setPreferredSize(new Dimension(300, 10)); progressbar.setBorderPainted(false); progressbar.setBackground(Color.pink); JPanel progressPane = new JPanel(); progressPane.add(progressbar); progressPane.setPreferredSize(new Dimension(300, 10)); JPanel panel = new JPanel(); b = new JButton("install"); stop = new JButton("pause"); b.setForeground(Color.blue); b.addActionListener(this); stop.addActionListener(this); panel.add(b); panel.add(stop); // timer=new Timer(100,this); timer = new Timer(1000/10, this); frame.add(panel, BorderLayout.NORTH); frame.add(progressPane, BorderLayout.CENTER); frame.add(label, BorderLayout.SOUTH); // frame.pack(); frame.setBounds(100, 100, 400, 130); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); }
protected void paintHorizontalBasis(Graphics g, Rectangle clip, Rectangle chartMask) { Rectangle dirty = clip.intersection(chartMask); g.setColor(getForeground()); if (location == SwingConstants.NORTH) { g.drawLine(dirty.x - 1, getHeight() - 1, dirty.x + dirty.width, getHeight() - 1); } else { g.drawLine(dirty.x, 0, dirty.x + dirty.width, 0); } }
protected void paintHorizontalTick(Graphics g, AxisMark mark, int x, Rectangle clip, Rectangle chartMask) { g.setColor(getForeground()); if (location == SwingConstants.NORTH) { g.drawLine(x, getHeight() - 2 - getAxisBasisExtent(), x, getHeight() - 2); } else { g.drawLine(x, 1, x, 1 + getAxisBasisExtent()); } }
protected void paintVerticalBasis(Graphics g, Rectangle clip, Rectangle chartMask) { g.setColor(getForeground()); if (location == SwingConstants.WEST) { g.drawLine(getWidth() - 1, chartMask.y - 1, getWidth() - 1, chartMask.y + chartMask.height); } else { g.drawLine(0, chartMask.y, 0, chartMask.y + chartMask.height); } }
private void makeDifficultyLabel() { difficultyLabel = new JLabel("Choose Difficulty: "); difficultyLabel.setBounds(0, height/3, width/2, height/10); difficultyLabel.setHorizontalAlignment(SwingConstants.RIGHT); difficultyLabel.setForeground(GameConstants.TEXT_COLOR); difficultyLabel.setFont(FileUtils.getFont(Font.BOLD, 40)); add(difficultyLabel); }
public Component getLayoutComponent(int constraint) { if (constraint == SwingConstants.NORTH) return north; if (constraint == SwingConstants.WEST) return west; if (constraint == SwingConstants.SOUTH) return south; if (constraint == SwingConstants.EAST) return east; if (constraint == SwingConstants.CENTER) return center; throw new IllegalArgumentException("Illegal constraint: " + // NOI18N constraintName(constraint)); }