/** Inicializace základních komponent okna */ private void init() { krokLabel = new JLabel("Synchronizace s web aplikací"); Font pismo = new Font("Arial", Font.BOLD, 14); krokLabel.setFont(pismo); NacitaciOkno.add(krokLabel); krokLabel.setBounds(90, 10, 250, 20); startButton = new JButton("Načíst"); startButton.setActionCommand("start"); startButton.setBounds(250, 110, 120, 25); startButton.addActionListener(new Start()); progressBar = new JProgressBar(0, 100); progressBar.setBounds(20, 60, 350, 25); progressBar.setValue(0); progressBar.setStringPainted(true); taskOutput = new JTextArea(5, 20); taskOutput.setMargin(new Insets(5, 5, 5, 5)); taskOutput.setEditable(false); NacitaciOkno.add(startButton); NacitaciOkno.add(progressBar); NacitaciOkno.setVisible(true); vybratButton = new JButton("Otevřít"); NacitaciOkno.add(vybratButton); vybratButton.setBounds(20, 110, 120, 25); vybratButton.addActionListener(new Zpet()); }
/** called by ImageRunnable */ void onImageProcessing() { canvas = new JLabel(); canvas.setBackground(Color.GREEN); canvas.repaint(); removeAll(); add(canvas); }
/** * This method initializes this * * @return void * @throws IOException * @throws FileNotFoundException * @throws ClassNotFoundException */ private void initialize() throws IOException, ClassNotFoundException { this.setSize(300, 258); this.setContentPane(getJContentPane()); this.setTitle("LinkedIn Friends Output"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Center(this); if (file.exists()) { // if the file exists we assume it has the AuthHandler in it - which in turn contains the // Access Token ObjectInputStream inputStream = new ObjectInputStream(new FileInputStream(file)); AuthHandler authHandler = (AuthHandler) inputStream.readObject(); accessToken = authHandler.getAccessToken(); jLabel1.show(false); jLabel2.show(false); getJButton1().show(false); getJTextField1().show(false); getJButton().setLocation(150, 5); setSize(265, 120); getJProgressBar().setSize(240, 22); getJProgressBar().setLocation(5, 45); flag = true; } else { flag = false; getJButton2().show(false); } }
/** Create the frame. */ public DeleteBlank() { setTitle("\u53BB\u6389\u5B57\u7B26\u4E32\u4E2D\u7684\u6240\u6709\u7A7A\u683C"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 386, 128); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JLabel label = new JLabel("\u8F93\u5165\u5B57\u7B26\u4E32\uFF1A"); label.setBounds(21, 10, 75, 15); contentPane.add(label); JButton button = new JButton("\u53BB\u9664\u7A7A\u683C"); button.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { do_button_actionPerformed(e); } }); button.setBounds(10, 49, 82, 23); contentPane.add(button); textField = new JTextField(); textField.setBounds(102, 2, 258, 30); contentPane.add(textField); textField.setColumns(10); resultField = new JTextField(); resultField.setBounds(102, 45, 258, 30); contentPane.add(resultField); resultField.setColumns(10); }
public static void updateText() { if (DatabaseUtil.countItems("USER_NOTES") == 0) { textLabel.setText("Create a Note"); } else { textLabel.setText("Select a Note"); } }
public LabeledSlider( int min, int max, int moltiplier, int val, String name, int width, int height, ChangeListener ext) { super(min, max * moltiplier); setPreferredSize(new Dimension(width, height)); putClientProperty("JSlider.isFilled", Boolean.TRUE); slide = new JLabel(""); add(slide); slide.setVisible(true); slide.setForeground(Color.BLACK); setMajorTickSpacing(max); putClientProperty("JSlider.isFilled", Boolean.TRUE); // setPaintTicks(true); // setPaintLabels(true); setName(name); setValue(val); addChangeListener(this); addChangeListener(ext); addAncestorListener(this); }
public static void main(String[] args) { final JPopupMenu menu = new JPopupMenu(); menu.setLayout(new GridLayout(0, 3, 5, 5)); final MenuedButton button = new MenuedButton("Icons", menu); for (int i = 0; i < 9; i++) { // replace "print.gif" with your own image final JLabel label = new JLabel("" + i); // new ImageIcon("resources/images/print.gif") ); label.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { button.getMainButton().setIcon(label.getIcon()); menu.setVisible(false); } }); menu.add(label); } JFrame frame = new JFrame("Button Test"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(new JLabel("Click Arrow Button To Show Popup"), BorderLayout.NORTH); frame.getContentPane().add(button, BorderLayout.CENTER); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); }
void refresh() { Command cmd = model.getCommand(); stateLabel.setForeground(ui.getColor(cmd)); stateLabel.setText(ui.getState(cmd)); activeButton.setAction(getActionMap().get(cmd.isRunning() ? "stop" : "close")); }
public TransactionPanel() { setLayout(new GridLayout(2, 1)); setBorder(BorderFactory.createMatteBorder(10, 10, 10, 10, DARK_CHAMPAGNE)); listModel.removeAllElements(); readTransactions(); receiptList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); titleLabel.setVerticalAlignment(SwingConstants.TOP); titleLabel.setFont(new Font(Font.SERIF, Font.BOLD, 24)); listLabel.setVerticalAlignment(SwingConstants.BOTTOM); listLabel.setFont(new Font(Font.SERIF, Font.ITALIC, 18)); buttonPanel.setBackground(DARK_CHAMPAGNE); buttonPanel.add(new MenuButton("Load", "Load", this)); // buttonPanel.add(new MenuButton("Delete","Delete",this)); // buttonPanel.add(new MenuButton("Void", "Void", this)); // buttonPanel.add(new MenuButton("Delete All","Delete All",this)); buttonPanel.add(new MenuButton("Print", "Print", this)); Tools.addBlankSpace(buttonPanel, 2); upperPanel.setBackground(DARK_CHAMPAGNE); upperPanel.add(titleLabel); upperPanel.add(buttonPanel); upperPanel.add(listLabel); add(upperPanel); add( new JScrollPane( receiptList, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS)); }
/** * untuk menjalankan ini icon dan title tidak boleh kosong * * @param db */ public void buildLabel(ODatabaseDocumentTx db) { label = new JLabel(icon); label.setText(title); label.setBorder(App.borderBlackBottom5555); label.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { if (master.isPerspectiveDefault()) { if (typeEfectWidget == WIDGET_1) { master.perspective1(); } else if (typeEfectWidget == WIDGET_2) { master.perspective2(); } else if (typeEfectWidget == WIDGET_3) { master.perspective3(); } else if (typeEfectWidget == WIDGET_4) { master.perspective4(); } } else { master.perspectiveDefault(); } } } public void mouseReleased(MouseEvent e) {} }); }
private void initialize() { setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); fileLabel = new JLabel(I18n.text("(no log loaded)")); fileLabel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); fileLabel.setBackground(Color.white); fileLabel.setOpaque(true); filePanel.add(fileLabel, BorderLayout.CENTER); fileSelection = new JButton("..."); fileSelection.setMargin(new Insets(1, 1, 1, 1)); fileSelection.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { selectFile(); } }); filePanel.add(fileSelection, BorderLayout.EAST); filePanel.setMaximumSize(new Dimension(200, 25)); add(filePanel); overlaysPanel = new JPanel(); overlaysPanel.setLayout(new BoxLayout(overlaysPanel, BoxLayout.PAGE_AXIS)); add(new JScrollPane(overlaysPanel)); }
public CollapsiblePanel(String aTitle, Component aComponent, boolean aStartCollapsed) { super(new BorderLayout()); content = aComponent; setBorder( BorderFactory.createCompoundBorder( BorderFactory.createEmptyBorder(5, 5, 5, 5), BorderFactory.createEtchedBorder())); title.setHorizontalAlignment(SwingConstants.CENTER); title.setFont(title.getFont().deriveFont(18.0f)); add(title, BorderLayout.NORTH); add(content, BorderLayout.CENTER); title.addMouseListener( new MouseAdapter() { @Override public void mouseClicked(MouseEvent aE) { if (aE.getClickCount() == 1) { content.setVisible(!content.isVisible()); } } }); if (aStartCollapsed) content.setVisible(false); setTitle(aTitle); }
private void owninitComponents() { /*Network status display*/ state.setBounds(3, 7, 25, 25); state.setVisible(true); statel.setBounds(30, 7, 100, 25); statel.setVisible(true); add(state); add(statel); /*Set Admin Defaults*/ AdminConfigPanel.setVisible(true); AdminLoginPanel.setVisible(true); /*Create required Tabs*/ new otherTab(jTabbedPane5); new Config(jTabbedPane5); explorer = new Explorer(jTabbedPane5); /*Set Icon Image*/ BufferedImage image = null; try { image = ImageIO.read(new File(substructure.PathHelper.getFile("hdd.png"))); } catch (IOException e) { out.print("(GUI) - owninitComponents : " + e.toString(), 2); } catch (fileSystemException ex) { out.print("(GUI) - owninitComponents : " + ex.toString(), 2); } setIconImage(image); }
@Override public void onOvalButtonPressed(Color c) { System.out.println("button pressed" + c); System.out.println(jTextField1.getForeground()); if (jTextField1.getForeground().getRed() == c.getRed() && jTextField1.getForeground().getGreen() == c.getGreen() && jTextField1.getForeground().getBlue() == c.getBlue()) { newScore += 100; System.out.println("score:" + newScore); generateButtons(); revalidate(); repaint(); } else { newScore -= 100; System.out.println("score:" + newScore); generateButtons(); revalidate(); repaint(); } numOfGames++; System.out.println(numOfGames); if (numOfGames == 5) { colorListener.onColorGameFinished(newScore); numOfGames = 0; return; } }
/** * Closes dialog box when the OK button is pressed, sets variables and calls algorithm. * * @param event Event that triggers function. */ public void actionPerformed(ActionEvent event) { String command = event.getActionCommand(); Object source = event.getSource(); if (command.equals("OK")) { if (setVariables()) { callAlgorithm(); } } else if (command.equals("Cancel")) { dispose(); } else if (command.equals("Help")) { // MipavUtil.showHelp(""); } else if (source.equals(doRicianCheckBox)) { if (doRicianCheckBox.isSelected()) { labelDegree.setEnabled(true); textDegree.setEnabled(true); } else { labelDegree.setEnabled(false); textDegree.setEnabled(false); } } else { // else if (source == thresholdCheckbox) super.actionPerformed(event); } }
public void addProcess() { labelAdd = new JLabel("crear"); ImageIcon icon = new ImageIcon(this.getClass().getResource("/images/agregarp.png")); labelAdd.setIcon(icon); labelAdd.setBounds(50, (MainWindow.DEFOULT_DIMENSION.height / 4) - 130, 100, 100); labelAdd.addMouseListener( new MouseListener() { @Override public void mousePressed(MouseEvent e) {} @Override public void mouseReleased(MouseEvent e) {} @Override public void mouseExited(MouseEvent e) {} @Override public void mouseEntered(MouseEvent arg0) { labelAdd.setToolTipText("Crear nuevo proceso"); } @Override public void mouseClicked(MouseEvent arg0) { window = new MainWindow(transition); createProcess = new WindowsCreateProcess(window, transition, ready); createProcess.setVisible(true); } }); this.add(labelAdd); }
/** Creates new form JMainFrame */ public JMainFrame() { initComponents(); splMain.setDividerLocation(0.5f); splMain.setResizeWeight(0.5f); _mapView = createMapView(); layeredPane.setLayout(new OverlayLayout(layeredPane)); layeredPane.add(_mapView, JLayeredPane.DEFAULT_LAYER); lblError = new JLabel(); lblError.setForeground(Color.RED); lblError.setFont(lblError.getFont().deriveFont(Font.BOLD)); layeredPane.add(lblError, JLayeredPane.POPUP_LAYER); lblError.setBorder(BorderFactory.createEmptyBorder(25, 25, 25, 25)); lblError.setText(""); _editorPane = createCodeTextPane(); pnlCode.setLayout(new BorderLayout()); pnlCode.add(_editorPane.getContainerWithLines(), BorderLayout.CENTER); refreshUI(); // 50.636311, 5.570565 MapFile mf = new MapFile(Constants.MAP_FILE); double lat = mf.boundingBox().getCenterPoint().latitude; double lng = mf.boundingBox().getCenterPoint().longitude; _mapView.getModel().mapViewPosition.setCenter(new LatLong(lat, lng)); _mapView.getModel().mapViewPosition.setZoomLevel((byte) 15); }
public void initlizeTimepane() { // timepanel的初始化 final TimePanel timepanel = new TimePanel(); timepanel.setBounds(530, 90, 70, 445); timepanel.setOpaque(true); // timepanel.setBackground(Color.orange); pane.add(timepanel); timejpb = new JProgressBar(); timejpb.setStringPainted(true); timejpb.setBackground(Color.yellow); timejpb.setForeground(Color.pink); timejpb.setPreferredSize(new Dimension(20, 370)); timejpb.setOrientation(JProgressBar.VERTICAL); // timejpb.paint(g); final JLabel timelabel1 = new JLabel(" "); timelabel1.setPreferredSize(new Dimension(50, 40)); timepanel.add(timelabel1); timelabel3 = new JLabel(" " + time); timelabel3.setFont(new Font("微软雅黑", Font.PLAIN, 16)); timelabel3.setPreferredSize(new Dimension(50, 15)); timepanel.add(timelabel3); timepanel.add(timejpb); timejpb.setMaximum(time * 20); timerObject = new gameTimer(time * 20); timerObject.start(); // 计时器的启动必须等待通信的建立完成,并且使双方的时间保持一致 doublehitCount = 0; // 同时连击数目初始化 lastDoubleHitTime = timerObject.getTime(); // 上次连击时间初始化 lastTwoHitTime = -1; // 倒是第二次连击时间初始化 // timeCaulater = new Timer(true); doublehitState = false; // System.out.println("DDD"); }
public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { final Color color = UIUtil.getTableFocusCellBackground(); Component component; final Module module = value instanceof Module ? (Module) value : null; try { UIManager.put(UIUtil.TABLE_FOCUS_CELL_BACKGROUND_PROPERTY, table.getSelectionBackground()); component = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if (module != null) { setText( module.getName() + " (" + FileUtil.toSystemDependentName(module.getModuleFilePath()) + ")"); } if (component instanceof JLabel) { ((JLabel) component).setBorder(noFocusBorder); } } finally { UIManager.put(UIUtil.TABLE_FOCUS_CELL_BACKGROUND_PROPERTY, color); } component.setEnabled(ProcessedModulesTable.this.isEnabled()); if (component instanceof JLabel) { final Icon icon = module != null ? ModuleType.get(module).getIcon() : null; JLabel label = (JLabel) component; label.setIcon(icon); label.setDisabledIcon(icon); } component.setForeground(isSelected ? table.getSelectionForeground() : table.getForeground()); return component; }
/** * Resets the status of this dialog work for switch of modes between dir and file selection. * * @author Fangping, 08/23/2010 */ private void resetActiveAreas() { srcFilesDirField.setText(""); enableOutputDirPanel(false); selectedFileCountLabel.setText(""); selectedFileCountLabel.setEnabled(false); finishButton.setEnabled(false); }
private void themeing() { aboutDialogLogger.entry(); Color color = new Color(0, 0, 0, 0); mainPanel.setOpaque(false); mainPanel.setBackground(new Color(51, 181, 229)); programLabel.setFont(new Font(programLabel.getFont().getName(), Font.BOLD, 24)); displayPanel.setOpaque(false); licenseScrollPane.setOpaque(false); licenseScrollPane.getViewport().setOpaque(false); licenseScrollPane.setBorder(null); licenseScrollPane.setViewportBorder(null); licenseTextArea.setOpaque(false); licenseTextArea.setBackground(color); licenseTextArea.setEditable(false); developerScrollPane.setOpaque(false); developerScrollPane.getViewport().setOpaque(false); developerScrollPane.setBorder(null); developerScrollPane.setViewportBorder(null); developerPane.setOpaque(false); developerPane.setBackground(color); developerPane.setEditable(false); emptyPanel.setOpaque(false); aboutDialogLogger.exit(LoggerValues.SUCCESSFUL_EXIT); }
/** * Sets the status label text. * * @param text the status label text (or null) */ public void setStatus(String text) { if (text != null) { statusLabel.setText(text); } else { statusLabel.setText("Ready"); } }
public void addComponents() { imageLabel.setBounds(0, -40, 450, 423); textLabel.setBounds(0, 260, 450, 35); add(imageLabel); add(textLabel); }
public AboutPanel() { setTitle("About Panel"); ImageIcon img = new ImageIcon("icons/preferences.jpg"); setIconImage(img.getImage()); Container contentPane = getContentPane(); contentPane.setLayout(new MigLayout()); setBackground(Color.GRAY); int style1 = Font.CENTER_BASELINE; Font font = new Font("Arial", style1, 13); about = new JLabel(); about.setFont(font); String key = userPrefs.getRegistrationKey(); if (key == null || key.length() == 0) { userPrefs.setRegistrationKey("Community Edition"); } about.setText("<html>WattzAp Community Edition<br/><br/>Version 2.5.1<br/>19th August 2015"); add(about, "alignx right, span"); debug = new JCheckBox("Enable Debugging"); if (userPrefs.isDebug()) { debug.setSelected(true); } else { debug.setSelected(false); } debug.addActionListener(this); add(debug); Dimension d = new Dimension(550, 300); this.setPreferredSize(d); pack(); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); }
private RecentProjectItemRenderer() { super(new VerticalFlowLayout()); setFocusable(true); myPath.setFont(myPath.getFont().deriveFont((float) 10)); add(myName); add(myPath); }
/** * Examines the supplied experiment to determine the results destination and attempts to load the * results. * * @param exp a value of type 'Experiment' */ protected void setInstancesFromExp(Experiment exp) { if ((exp.getResultListener() instanceof CSVResultListener)) { File resultFile = ((CSVResultListener) exp.getResultListener()).getOutputFile(); if ((resultFile == null)) { m_FromLab.setText("No result file"); } else { setInstancesFromFile(resultFile); } } else if (exp.getResultListener() instanceof DatabaseResultListener) { String dbaseURL = ((DatabaseResultListener) exp.getResultListener()).getDatabaseURL(); try { if (m_InstanceQuery == null) { m_InstanceQuery = new InstanceQuery(); } m_InstanceQuery.setDatabaseURL(dbaseURL); m_InstanceQuery.connectToDatabase(); String tableName = m_InstanceQuery.getResultsTableName(exp.getResultProducer()); setInstancesFromDatabaseTable(tableName); } catch (Exception ex) { m_FromLab.setText("Problem reading database"); } } else { m_FromLab.setText("Can't get results from experiment"); } }
// Renders image from canon DSLR private static void canonSLR(final CanonCamera camera) { renderCanon = new JLabel(); if (canon = true) { while (canon = true) { try { Thread.sleep(50); BufferedImage canonimage = camera.downloadLiveView(); if (canonimage != null) { renderCanon.setIcon(new ImageIcon(canonimage)); renderCanon.setBounds((width / 2) - 528, 10, 1056, 704); renderCanon.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 3)); renderCanon.setToolTipText("Live Canon DSLR feed"); renderCanon.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR)); window.add(renderCanon); webcam = false; nikon = false; System.out.println("Battery: " + camera.getProperty(kEdsPropID_BatteryLevel)); canonimage.flush(); } } catch (InterruptedException ex) { Logger.getLogger(Controls.class.getName()).log(Level.SEVERE, null, ex); } } } }
public void setting() { labelSetting = new JLabel(); ImageIcon icon = new ImageIcon(this.getClass().getResource("/images/configuracion.png")); labelSetting.setIcon(icon); labelSetting.setBounds(50, (MainWindow.DEFOULT_DIMENSION.height / 4) * 3 - 130, 100, 100); labelSetting.addMouseListener( new MouseListener() { @Override public void mouseReleased(MouseEvent e) {} @Override public void mousePressed(MouseEvent e) {} @Override public void mouseExited(MouseEvent e) {} @Override public void mouseEntered(MouseEvent e) { labelSetting.setToolTipText("Configuración"); } @Override public void mouseClicked(MouseEvent e) { PropertiesWindow propertiesWindow = new PropertiesWindow(window, transition); propertiesWindow.setVisible(true); } }); this.add(labelSetting); }
private void createPresetCombo() { JLabel myTimelineLabel = new JLabel("timeline"); myTimelineLabel.setFont(SwingGuiConstants.ARIAL_11); add(myTimelineLabel); CCNIOUtil.createDirectories(CCNIOUtil.dataPath("settings")); _myPresetList = new JComboBox<String>(); _myPresetList.setEditable(true); _myPresetList.addItemListener( new ItemListener() { @Override public void itemStateChanged(ItemEvent theE) { if (_myEventPoint == null) return; switch (theE.getStateChange()) { case ItemEvent.SELECTED: _myEventPoint.content( new TimedEventPointContent(_myPresetList.getSelectedItem().toString())); _myController.view().render(); break; } } }); CCUIStyler.styleTransportComponent(_myPresetList, 120, 20); _myPanel.add(_myPresetList); }
public TestSwingExample1() { super("ActionExample"); setChannel(currentChannel); // enable/disable the Actions as appropriate channelLabel.setHorizontalAlignment(JLabel.CENTER); channelLabel.setFont(new Font("Serif", Font.PLAIN, 32)); getContentPane().add(channelLabel, BorderLayout.NORTH); JPanel buttonPanel = new JPanel(new GridLayout(2, 2, 16, 6)); buttonPanel.setBorder(BorderFactory.createEmptyBorder(6, 16, 16, 16)); getContentPane().add(buttonPanel, BorderLayout.CENTER); buttonPanel.add(new JButton(upAction)); buttonPanel.add(new JButton(gotoFavoriteAction)); buttonPanel.add(new JButton(downAction)); buttonPanel.add(new JButton(setFavoriteAction)); JMenuBar mb = new JMenuBar(); JMenu menu = new JMenu("Channel"); menu.add(new JMenuItem(upAction)); menu.add(new JMenuItem(downAction)); menu.addSeparator(); menu.add(new JMenuItem(gotoFavoriteAction)); menu.add(new JMenuItem(setFavoriteAction)); mb.add(menu); setJMenuBar(mb); }