Java Code Examples for javax.swing.JProgressBar#setStringPainted()

The following examples show how to use javax.swing.JProgressBar#setStringPainted() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StartupPanel.java    From pcgen with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Create a new instance of StartupPanel
 * @param gameModeFileLoader
 * @param campaignFileLoader
 */
public StartupPanel(GameModeFileLoader gameModeFileLoader, CampaignFileLoader campaignFileLoader)
{
	this.gameModeFileLoader = gameModeFileLoader;
	this.campaignFileLoader = campaignFileLoader;
	message = new JPanel();
	message.setLayout(new UnstretchingGridLayout(0, 1));
	message
		.add(new JLabel("Welcome to the PCGen " + PCGenPropBundle.getProdVersionSeries() + " Data Converter..."));
	message.add(new JLabel(" "));
	message.add(new JLabel("Loading Game Modes and Campaign Information."));
	message.add(new JLabel(" "));

	progressBar = new JProgressBar(0, 3);
	progressBar.setValue(0);
	progressBar.setStringPainted(true);

	message.add(progressBar);
	message.add(new JLabel(" "));
}
 
Example 2
Source File: ReferencesBrowserController.java    From netbeans with Apache License 2.0 6 votes vote down vote up
Dialog createProgressPanel(final String message, BoundedRangeModel model) {
    Dialog dialog;
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout(10, 10));
    panel.setBorder(new EmptyBorder(15, 15, 15, 15));
    panel.add(new JLabel(message), BorderLayout.NORTH);

    final Dimension ps = panel.getPreferredSize();
    ps.setSize(Math.max(ps.getWidth(), DEFAULT_WIDTH), Math.max(ps.getHeight(), DEFAULT_HEIGHT));
    panel.setPreferredSize(ps);

    final JProgressBar progress = new JProgressBar();
    if (model == null) {
        progress.setIndeterminate(true);
    } else {
        progress.setStringPainted(true);
        progress.setModel(model);
    }
    panel.add(progress, BorderLayout.SOUTH);
    dialog = DialogDisplayer.getDefault().createDialog(new DialogDescriptor(panel, Bundle.ReferencesBrowserController_ProgressDialogCaption(), true, new Object[] {  },
                                                       DialogDescriptor.CANCEL_OPTION, DialogDescriptor.RIGHT_ALIGN,
                                                       null, null));

    return dialog;
}
 
Example 3
Source File: ProgressMonitor.java    From pdfxtk with Apache License 2.0 6 votes vote down vote up
public Component getTreeCellRendererComponent(JTree   tree,
					  Object  value,
					  boolean selected,
					  boolean expanded,
					  boolean leaf,
					  int     row,
					  boolean hasFocus) {
     if(value instanceof ProgressWatcher.Operation &&
 !(value instanceof ProgressWatcher.ThreadInfo)) {
ProgressWatcher.Operation op = (ProgressWatcher.Operation)value;
if(op.getUserObject() == null) {
  JProgressBar pb = new JProgressBar(op.progress);
  pb.setString(op.description);
  pb.setStringPainted(true);
  op.setUserObject(pb);
}
return (Component)op.getUserObject();
     }
     else {
JLabel l = (JLabel)old.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
l.setIcon(Resource.THREAD);
return l;
     }
   }
 
Example 4
Source File: CollapseSimulatorGUI.java    From rcrs-server with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
   Construct a collapse simulator GUI.
*/
public CollapseSimulatorGUI() {
    super(new GridLayout(0, 2));

    timeLabel = new JLabel("Not started");
    statusLabel = new JLabel("Not started");
    collapseProgress = new JProgressBar(0, 1);
    fireProgress = new JProgressBar(0, 1);
    blockadeProgress = new JProgressBar(0, 1);

    collapseProgress.setStringPainted(true);
    fireProgress.setStringPainted(true);
    blockadeProgress.setStringPainted(true);

    add(new JLabel("Timestep"));
    add(timeLabel);
    add(new JLabel("Status"));
    add(statusLabel);
    add(new JLabel("Collapsing buildings"));
    add(collapseProgress);
    add(new JLabel("Fire damage"));
    add(fireProgress);
    add(new JLabel("Creating blockades"));
    add(blockadeProgress);
}
 
Example 5
Source File: DemoTheatreApp.java    From arcgis-runtime-demo-java with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a progress bar.
 * 
 * @param parent progress bar's parent. The horizontal axis of the progress bar will be center-aligned to the parent.
 * @return a progress bar.
 */
private static JProgressBar createProgressBar(final JComponent parent) {
  final JProgressBar progressBar = new JProgressBar();
  progressBar.setSize(260, 20);
  parent.addComponentListener(new ComponentAdapter() {
    @Override
    public void componentResized(ComponentEvent e) {
      progressBar.setLocation(
        parent.getWidth() / 2 - progressBar.getWidth() / 2,
        parent.getHeight() - progressBar.getHeight() - 20);
    }
  });
  progressBar.setStringPainted(true);
  progressBar.setIndeterminate(true);
  progressBar.setVisible(false);
  return progressBar;
}
 
Example 6
Source File: JPanel_TaskManager.java    From MobyDroid with Apache License 2.0 5 votes vote down vote up
public TaskProgressCellRenderer() {
    jProgressBar = new JProgressBar(0, 100);
    jProgressBar.setBackground(MaterialColor.WHITE);
    jProgressBar.setForeground(MaterialColor.BLUE_700);
    jProgressBar.setStringPainted(true);
    jProgressBar.setOpaque(false);
}
 
Example 7
Source File: GUIFrame.java    From jaamsim with Apache License 2.0 5 votes vote down vote up
private void addRunProgress(JToolBar mainToolBar, Insets margin) {
	progressBar = new JProgressBar( 0, 100 );
	progressBar.setPreferredSize( new Dimension( 120, controlRealTime.getPreferredSize().height ) );
	progressBar.setValue( 0 );
	progressBar.setStringPainted( true );
	progressBar.setToolTipText(formatToolTip("Run Progress",
			"Percent of the present simulation run that has been completed."));
	mainToolBar.add( progressBar );
}
 
Example 8
Source File: ProgressDialog.java    From Course_Generator with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Constructor
 * 
 * @param progressBar The progress bar this has to update
 */
public ProgressDialog(Window parent, String dialogTitle) {
	super(parent, dialogTitle, ModalityType.APPLICATION_MODAL);

	setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
	setResizable(false);

	bundle = java.util.ResourceBundle.getBundle("course_generator/Bundle");
	Container paneGlobal = getContentPane();
	paneGlobal.setLayout(new GridBagLayout());

	// -- Progress bar
	progressBar = new JProgressBar(0, 100);
	progressBar.setValue(0);
	progressBar.setStringPainted(true);
	progressBar.setPreferredSize(new Dimension(500, 30));
	Utils.addComponent(paneGlobal, progressBar, 0, 0, 1, 1, 0, 0, 10, 10, 10, 10,
			GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);

	// -- Cancel button
	buttonCancel = new JButton(bundle.getString("Global.btCancel.text"));
	buttonCancel.addActionListener(new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent arg0) {
			if (progressDialogListener != null) {
				progressDialogListener.progressDialogCancelled();
			}

		}
	});
	Utils.addComponent(paneGlobal, buttonCancel, 0, 1, 1, 1, 0, 0, 0, 10, 10, 10, GridBagConstraints.CENTER,
			GridBagConstraints.NONE);

	pack();
	// -- Center the dialog on the parent
	setLocationRelativeTo(parent);
}
 
Example 9
Source File: StatusBar.java    From tda with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * create the memory status panel, also includes a resize icon on the lower right
 */
private JPanel createMemoryStatus() {
    memStatus = new JProgressBar(0, 100);
    memStatus.setPreferredSize(new Dimension(100, 15));
    memStatus.setStringPainted(true);
    JPanel memPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    memPanel.add(memStatus);
    
    // Start Updater
    new Thread(new MemoryStatusUpdater(memStatus)).start();
    
    return memPanel;
}
 
Example 10
Source File: JComponentBuilders.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
protected void setupInstance(JProgressBar instance) {
    super.setupInstance(instance);
    
    instance.setBorderPainted(paintBorder);
    if (model != null) instance.setModel(model.createInstance());
    if (progressString != null) instance.setString(progressString);
    instance.setStringPainted(paintString);
    instance.setIndeterminate(indeterminate);
}
 
Example 11
Source File: ProgressBar.java    From stendhal with GNU General Public License v2.0 5 votes vote down vote up
private void initializeComponents() {
	JPanel contentPane = (JPanel) this.getContentPane();

	contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.PAGE_AXIS));
	contentPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

	contentPane.add(new JLabel("Connecting..."));
	contentPane.add(Box.createVerticalStrut(5));

	progressBar = new JProgressBar(0, MAX_VALUE);
	progressBar.setStringPainted(false);
	contentPane.add(progressBar);
}
 
Example 12
Source File: MTGSplashScreen.java    From MtgDesktopCompanion with GNU General Public License v3.0 5 votes vote down vote up
public MTGSplashScreen() {
	JPanel panel = new JPanel() {
		/**
		 * 
		 */
		private static final long serialVersionUID = 1L;

		@Override
		protected void paintComponent(Graphics g) {
			if (g instanceof Graphics2D) {
				final int R = 240;
				final int G = 240;
				final int B = 240;
				Paint p = new GradientPaint(0.0f, 0.0f, new Color(R, G, B, 0), 0.0f, getHeight(),
						new Color(R, G, B, 0), true);
				Graphics2D g2d = (Graphics2D) g;
				g2d.setPaint(p);
				g2d.fillRect(0, 0, getWidth(), getHeight());
			}
		}
	};
	setBackground(new Color(0, 0, 0, 0));

	getContentPane().add(panel);
	panel.setLayout(new BorderLayout(0, 0));

	JLabel lblIcons = new JLabel(MTGConstants.ICON_SPLASHSCREEN);
	panel.add(lblIcons, BorderLayout.CENTER);
	lblIcons.setOpaque(false);

	progressBar = new JProgressBar();
	panel.add(progressBar, BorderLayout.SOUTH);
	progressBar.setMinimum(0);
	progressBar.setIndeterminate(true);
	progressBar.setStringPainted(true);
	progressBar.setForeground(new Color(101,13,136));
	pack();
	setLocationRelativeTo(null);
}
 
Example 13
Source File: PreviewComponent.java    From otroslogviewer with Apache License 2.0 5 votes vote down vote up
public PreviewComponent() {
  super(new MigLayout());
  titleLabel = new JLabel(Messages.getMessage("preview.label"));
  nameLabel = new JLabel();
  contentArea = new JTextArea();
  contentArea.setEditable(false);
  border = BorderFactory.createTitledBorder(Messages.getMessage("preview.fileContent"));
  contentArea.setBorder(border);
  contentArea.setAutoscrolls(false);
  contentArea.setFont(new Font("Courier New", Font.PLAIN, contentArea.getFont().getSize()));

  contentScrollPane = new JScrollPane(contentArea);
  contentScrollPane.setAutoscrolls(false);

  progressBar = new JProgressBar();
  progressBar.setStringPainted(true);
  progressBar.setMaximum(1);
  enabledCheckBox = new JCheckBox(Messages.getMessage("preview.enable"), true);
  enabledCheckBox.setMnemonic(Messages.getMessage("preview.enable.mnemonic").charAt(0));
  enabledCheckBox.setRolloverEnabled(true);
  enabledCheckBox.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent actionEvent) {
      boolean enabled = enabledCheckBox.isSelected();
      progressBar.setEnabled(enabled);
      contentScrollPane.setEnabled(enabled);
      contentArea.setEnabled(enabled);
      nameLabel.setEnabled(enabled);
      titleLabel.setEnabled(enabled);
    }
  });

  add(titleLabel, "dock north, gap 5 5 5 5, center");
  add(nameLabel, "dock north, gap 5 5 5 5");
  add(contentScrollPane, "dock center, gap 5 5 5 5");
  add(enabledCheckBox, "dock south, gap 0 5 5 5");
  add(progressBar, "dock south, gap 5 5 5 5");
}
 
Example 14
Source File: SummaryPanel.java    From swift-k with Apache License 2.0 5 votes vote down vote up
private JProgressBar makeProgress(SpringLayout sl, JLabel label) {
    if (label != null) {
        add(label);
    }
    
    JProgressBar pb = new JProgressBar();
    pb.setString("");
    pb.setStringPainted(true);
    add(pb);
    
    fixEdges(sl, label, pb, this);
    
    return pb;
}
 
Example 15
Source File: ManufacturePanel.java    From mars-sim with GNU General Public License v3.0 4 votes vote down vote up
/**
	 * Constructor
	 * @param process the manufacturing process.
	 * @param showBuilding is the building name shown?
	 * @param processStringWidth the max string width to display for the process name.
	 */
	public ManufacturePanel(ManufactureProcess process, boolean showBuilding, int processStringWidth) {
		// Call WebPanel constructor
		super();

		// Initialize data members.
		this.process = process;

        // Set layout
		if (showBuilding) setLayout(new GridLayout(4, 1, 0, 0));
		else setLayout(new GridLayout(3, 1, 0, 0));

        // Set border
        setBorder(new MarsPanelBorder());

        // Prepare name panel.
        WebPanel namePane = new WebPanel(new FlowLayout(FlowLayout.LEFT, 1, 0));
        add(namePane);

        // Prepare cancel button.
        JButton cancelButton = new JButton(ImageLoader.getIcon("CancelSmall"));
        cancelButton.setMargin(new Insets(0, 0, 0, 0));
        cancelButton.addActionListener(new ActionListener() {
        	public void actionPerformed(ActionEvent event) {
//        		try {
        			getManufactureProcess().getWorkshop().endManufacturingProcess(getManufactureProcess(), true);
//        		}
//        		catch (BuildingException e) {}
	        }
        });
        cancelButton.setToolTipText("Cancel manufacturing process");
        namePane.add(cancelButton);

        // Prepare name label.
        String name = process.getInfo().getName();
        if (name.length() > 0) {
        	String firstLetter = name.substring(0, 1).toUpperCase();
        	name = " " + firstLetter + name.substring(1);
        }
        if (name.length() > processStringWidth) name = name.substring(0, processStringWidth) + "...";
		// Capitalize process names
        JLabel nameLabel = new JLabel(Conversion.capitalize(name), JLabel.CENTER);
        namePane.add(nameLabel);

        if (showBuilding) {
        	// Prepare building name label.
        	String buildingName = process.getWorkshop().getBuilding().getNickName();
        	JLabel buildingNameLabel = new JLabel(buildingName, JLabel.CENTER);
        	add(buildingNameLabel);
        }

        // Prepare work panel.
        WebPanel workPane = new WebPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
        add(workPane);

        // Prepare work label.
        JLabel workLabel = new JLabel("Work: ", JLabel.LEFT);
        workPane.add(workLabel);

        // Prepare work progress bar.
        JProgressBar workBar = new JProgressBar();
        workBarModel = workBar.getModel();
        workBar.setStringPainted(true);
        workPane.add(workBar);

        // Prepare time panel.
        WebPanel timePane = new WebPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
        add(timePane);

        // Prepare time label.
        JLabel timeLabel = new JLabel("Time: ", JLabel.LEFT);
        timePane.add(timeLabel);

        // Prepare time progress bar.
        JProgressBar timeBar = new JProgressBar();
        timeBarModel = timeBar.getModel();
        timeBar.setStringPainted(true);
        timePane.add(timeBar);

        // Update progress bars.
        update();

        // Add tooltip.
        setToolTipText(getToolTipString(process.getInfo(), process.getWorkshop().getBuilding()));
	}
 
Example 16
Source File: TabPanelMaintenance.java    From mars-sim with GNU General Public License v3.0 4 votes vote down vote up
/**
		 * Constructor.
		 * 
		 * @param building the building to display.
		 */
		public BuildingMaintenancePanel(Building building) {
			// User WebPanel constructor.
			super();

			manager = building.getMalfunctionManager();

			setLayout(new GridLayout(4, 1, 0, 0));
//			setBorder(new MarsPanelBorder());

			WebLabel buildingLabel = new WebLabel(building.getNickName(), WebLabel.LEFT);
			buildingLabel.setFont(new Font("Serif", Font.BOLD, 14));
			add(buildingLabel);

			// Add wear condition cache and label.
			wearConditionCache = (int) Math.round(manager.getWearCondition());
			wearConditionLabel = new WebLabel(
					Msg.getString("BuildingPanelMaintenance.wearCondition", wearConditionCache),
					WebLabel.CENTER);
			TooltipManager.setTooltip(wearConditionLabel, 
					Msg.getString("BuildingPanelMaintenance.wear.toolTip"),
					TooltipWay.down);
			// wearConditionLabel.setMargin (4);
//			add(wearConditionLabel);

			WebPanel mainPanel = new WebPanel(new BorderLayout(0, 0));
			add(mainPanel);

			lastCompletedCache = (int) (manager.getTimeSinceLastMaintenance() / 1000D);
			lastLabel = new WebLabel("Last completed : " + lastCompletedCache + " sols ago", WebLabel.LEFT);
			mainPanel.add(lastLabel, BorderLayout.WEST);
			// lastLabel.setToolTipText(getToolTipString());
			TooltipManager.setTooltip(lastLabel, getToolTipString(), TooltipWay.down);

			// Prepare progress bar panel.
			WebPanel progressBarPanel = new WebPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
//			mainPanel.add(progressBarPanel, BorderLayout.CENTER);
			add(progressBarPanel);
			
			mainPanel.add(wearConditionLabel, BorderLayout.CENTER);
			
			// Prepare progress bar.
			JProgressBar progressBar = new JProgressBar();
			progressBarModel = progressBar.getModel();
			progressBar.setStringPainted(true);
			progressBar.setPreferredSize(new Dimension(240, 15));
			progressBarPanel.add(progressBar);

			// Set initial value for progress bar.
			double completed = manager.getMaintenanceWorkTimeCompleted();
			double total = manager.getMaintenanceWorkTime();
			int percentDone = (int) (100D * (completed / total));
			progressBarModel.setValue(percentDone);

			// Prepare parts label.
			Map<Integer, Integer> parts = manager.getMaintenanceParts();
			partsLabel = new WebLabel(getPartsString(parts, false), WebLabel.CENTER);
			partsLabel.setPreferredSize(new Dimension(-1, -1));
			add(partsLabel);

			TooltipManager.setTooltip(partsLabel, getPartsString(parts, false), TooltipWay.down);
		}
 
Example 17
Source File: MainWindow.java    From Luyten with Apache License 2.0 4 votes vote down vote up
public MainWindow(File fileFromCommandLine) {
	configSaver = ConfigSaver.getLoadedInstance();
	windowPosition = configSaver.getMainWindowPosition();
	luytenPrefs = configSaver.getLuytenPreferences();
	
	mainMenuBar = new MainMenuBar(this);
	this.setJMenuBar(mainMenuBar);

	this.adjustWindowPositionBySavedState();
	this.setHideFindBoxOnMainWindowFocus();
	this.setShowFindAllBoxOnMainWindowFocus();
	this.setQuitOnWindowClosing();
	this.setTitle(TITLE);
	this.setIconImage(new ImageIcon(
			Toolkit.getDefaultToolkit().getImage(this.getClass().getResource("/resources/Luyten.png"))).getImage());

	JPanel panel1 = new JPanel(new FlowLayout(FlowLayout.LEFT));
	label = new JLabel();
	label.setHorizontalAlignment(JLabel.LEFT);
	panel1.setBorder(new BevelBorder(BevelBorder.LOWERED));
	panel1.setPreferredSize(new Dimension(this.getWidth() / 2, 20));
	panel1.add(label);

	JPanel panel2 = new JPanel(new FlowLayout(FlowLayout.RIGHT));
	bar = new JProgressBar();

	bar.setStringPainted(true);
	bar.setOpaque(false);
	bar.setVisible(false);
	panel2.setPreferredSize(new Dimension(this.getWidth() / 3, 20));
	panel2.add(bar);

	model = new Model(this);
	this.getContentPane().add(model);

	JSplitPane spt = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panel1, panel2) {
		private static final long serialVersionUID = 2189946972124687305L;
		private final int location = 400;

		{
			setDividerLocation(location);
		}

		@Override
		public int getDividerLocation() {
			return location;
		}

		@Override
		public int getLastDividerLocation() {
			return location;
		}
	};
	spt.setBorder(new BevelBorder(BevelBorder.LOWERED));
	spt.setPreferredSize(new Dimension(this.getWidth(), 24));
	this.add(spt, BorderLayout.SOUTH);
	if (fileFromCommandLine != null) {
		model.loadFile(fileFromCommandLine);
	}

	try {
		DropTarget dt = new DropTarget();
		dt.addDropTargetListener(new DropListener(this));
		this.setDropTarget(dt);
	} catch (Exception e) {
		Luyten.showExceptionDialog("Exception!", e);
	}

	fileDialog = new FileDialog(this);
	fileSaver = new FileSaver(bar, label);

	this.setExitOnEscWhenEnabled(model);

	if (fileFromCommandLine == null || fileFromCommandLine.getName().toLowerCase().endsWith(".jar")
			|| fileFromCommandLine.getName().toLowerCase().endsWith(".zip")) {
		model.startWarmUpThread();
	}
	
	if(RecentFiles.load() > 0) mainMenuBar.updateRecentFiles();
}
 
Example 18
Source File: Main.java    From Face-Recognition with GNU General Public License v3.0 4 votes vote down vote up
public void generalInit(Container c) {
    c.setLayout(new BorderLayout());
    main = new JPanel();

    bkd = new ImageBackgroundPanel();
    c.add(bkd, "Center");

    //c.add(main, "Center");
    //main.add(bckgd);

    jbLoadImage = new JButton("Load Images");
    jbLoadImage.addActionListener(this);
    jbCropImage = new JButton("Crop Images");
    jbCropImage.addActionListener(this);
    jbCropImage.setEnabled(false);
    jbTrain = new JButton("Compute Eigen Vectors");
    jbTrain.setEnabled(false);
    jbTrain.addActionListener(this);
    jbProbe = new JButton("Identify Face");
    jbProbe.addActionListener(this);
    jbProbe.setEnabled(false);
    jbDisplayFeatureSpace = new JButton("Display Result Chart");
    jbDisplayFeatureSpace.addActionListener(this);
    jbDisplayFeatureSpace.setEnabled(false);
    //jlClassthreshold = new JLabel("Factor");
    // jtfClassthreshold = new JTextField(""+classthreshold);
    //jbClassthreshold = new JButton("Update Threshold");
    // jbClassthreshold.addActionListener(this);

    faceCandidate = new FaceItem();
    faceCandidate.setBorder(BorderFactory.createRaisedBevelBorder());

    jlAverageFace = new JLabel();
    jlAverageFace.setVerticalTextPosition(JLabel.BOTTOM);
    jlAverageFace.setHorizontalTextPosition(JLabel.CENTER);

    jlStatus = new JProgressBar(JProgressBar.HORIZONTAL, 0, 100);
    jlStatus.setBorder(BorderFactory.createEtchedBorder());
    jlStatus.setStringPainted(true);
    jlist = new JList();
    main.setLayout(new BorderLayout());
    JPanel right = new JPanel();

    jbLoadImage.setFont(new Font("Verdana", 30, 18));
    //jbCropImage.setFont(new Font("Cambria", 20, 28));
    jbTrain.setFont(new Font("Verdana", 30, 18));
    jbProbe.setFont(new Font("Verdana", 30, 18));
    jbDisplayFeatureSpace.setFont(new Font("Verdana", 30, 18));
    right.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.PAGE_START;

    gbc.gridy = 1;
    gbc.gridwidth = 4;
    gbc.ipady = 30;
    gbc.ipadx = 110;
    gbc.insets = new Insets(10, 20, 10, 20);

    //JLabel myp = new JLabel("Project ID: PW13A01");
    //myp.setFont(new Font("Tahoma", 20, 20));
    //right.add(myp);
    //gbc.gridy = 3;

    try {
        String imPath = System.getProperty("user.dir");
        imPath = imPath.replace('\\', '/');
        BufferedImage myPicture = ImageIO.read(new File(imPath + "/src/src/face.png"));
        JLabel picLabel = new JLabel(new ImageIcon(myPicture));
        //picLabel.setSize(250, 220);
        right.add(picLabel);
    } catch (IOException ex) {
        System.out.println("Image face.png missing\n" + ex);
    }


    right.add(jbLoadImage, gbc);
    //gbc.gridy = 1; right.add(jbCropImage, gbc);
    gbc.gridy = 4;
    right.add(jbTrain, gbc);
    gbc.gridy = 6;
    right.add(jbProbe, gbc);
    gbc.gridy = 8;
    right.add(jbDisplayFeatureSpace, gbc);
    //gbc.gridy = 5; gbc.gridwidth = 1; right.add(jlClassthreshold, gbc);
    // gbc.gridy = 5; gbc.gridwidth = 1; right.add(jtfClassthreshold, gbc);
    // gbc.gridy = 6; gbc.gridwidth = 2; right.add(jbClassthreshold, gbc);
   /* gbc.gridy = 7;
     gbc.weighty = 1.0;
     gbc.fill = GridBagConstraints.VERTICAL | GridBagConstraints.HORIZONTAL;
     right.add(jlAverageFace, gbc);  */

    c.add(right, BorderLayout.EAST);


    //Mark



}
 
Example 19
Source File: RocPlot.java    From rtg-tools with BSD 2-Clause "Simplified" License 4 votes vote down vote up
/**
 * Creates a new swing plot.
 * @param precisionRecall true defaults to precision recall graph
 * @param interpolate if true, enable curve interpolation
 */
RocPlot(boolean precisionRecall, boolean interpolate) {
  mInterpolate = interpolate;
  mMainPanel = new JPanel();
  UIManager.put("FileChooser.readOnly", Boolean.TRUE);
  mFileChooser = new JFileChooser();
  final Action details = mFileChooser.getActionMap().get("viewTypeDetails");
  if (details != null) {
    details.actionPerformed(null);
  }
  mFileChooser.setMultiSelectionEnabled(true);
  mFileChooser.setFileFilter(new RocFileFilter());
  mZoomPP = new RocZoomPlotPanel();
  mZoomPP.setOriginIsMin(true);
  mZoomPP.setTextAntialiasing(true);
  mProgressBar = new JProgressBar(-1, -1);
  mProgressBar.setVisible(true);
  mProgressBar.setStringPainted(true);
  mProgressBar.setIndeterminate(true);
  mStatusLabel = new JLabel();
  mPopup = new JPopupMenu();
  mRocLinesPanel = new RocLinesPanel(this);
  mScrollPane = new JScrollPane(mRocLinesPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  mScrollPane.setWheelScrollingEnabled(true);
  mLineWidthSlider = new JSlider(JSlider.HORIZONTAL, LINE_WIDTH_MIN, LINE_WIDTH_MAX, 1);
  mScoreCB = new JCheckBox("Show Scores");
  mScoreCB.setSelected(true);
  mSelectAllCB = new JCheckBox("Select / Deselect all");
  mTitleEntry = new JTextField("ROC");
  mTitleEntry.setMaximumSize(new Dimension(Integer.MAX_VALUE, mTitleEntry.getPreferredSize().height));
  mOpenButton = new JButton("Open...");
  mOpenButton.setToolTipText("Add a new curve from a file");
  mCommandButton = new JButton("Cmd...");
  mCommandButton.setToolTipText("Send the equivalent rocplot command-line to the terminal");
  final ImageIcon icon = createImageIcon("com/rtg/graph/resources/realtimegenomics_logo.png", "RTG Logo");
  mIconLabel = new JLabel(icon);
  mIconLabel.setBackground(new Color(16, 159, 205));
  mIconLabel.setForeground(Color.WHITE);
  mIconLabel.setOpaque(true);
  mIconLabel.setFont(new Font("Arial", Font.BOLD, 24));
  mIconLabel.setHorizontalAlignment(JLabel.LEFT);
  mIconLabel.setIconTextGap(50);
  if (icon != null) {
    mIconLabel.setMinimumSize(new Dimension(icon.getIconWidth(), icon.getIconHeight()));
  }
  mGraphType = new JComboBox<>(new String[] {ROC_PLOT, PRECISION_SENSITIVITY});
  mGraphType.setSelectedItem(precisionRecall ? PRECISION_SENSITIVITY : ROC_PLOT);
  configureUI();
}
 
Example 20
Source File: Launcher.java    From open-ig with GNU Lesser General Public License v3.0 4 votes vote down vote up
/** Create the progress panel. */
void createProgressPanel() {
	GroupLayout gl = new GroupLayout(progressPanel);
	progressPanel.setLayout(gl);
	
	currentActionLabel = new JLabel();
	currentFileLabel = new JLabel();
	currentFileProgressLabel = new JLabel();
	totalFileProgressLabel = new JLabel();

	currentAction = new JLabel();
	currentFile = new JLabel();
	currentFileProgress = new JLabel();
	totalFileProgress = new JLabel();

	fileProgress = new JProgressBar();
	fileProgress.setFont(fontMedium);
	fileProgress.setStringPainted(true);
	totalProgress = new JProgressBar();
	totalProgress.setFont(fontMedium);
	totalProgress.setStringPainted(true);
	
	currentActionLabel.setFont(fontLarge);
	currentActionLabel.setForeground(Color.LIGHT_GRAY);
	currentFileLabel.setFont(fontMedium);
	currentFileLabel.setForeground(Color.LIGHT_GRAY);
	currentFileProgressLabel.setFont(fontMedium);
	currentFileProgressLabel.setForeground(Color.LIGHT_GRAY);
	totalFileProgressLabel.setFont(fontMedium);
	totalFileProgressLabel.setForeground(Color.LIGHT_GRAY);
	
	currentAction.setFont(fontLarge);
	currentFile.setFont(fontMedium);
	currentFileProgress.setFont(fontMedium);
	totalFileProgress.setFont(fontMedium);
	currentAction.setForeground(Color.ORANGE);
	currentFile.setForeground(Color.WHITE);
	currentFileProgress.setForeground(Color.WHITE);
	totalFileProgress.setForeground(Color.WHITE);
	fileProgress.setForeground(backgroundColoring);
	totalProgress.setForeground(backgroundColoring);
	
	
	gl.setHorizontalGroup(
		gl.createParallelGroup()
		.addGroup(
			gl.createSequentialGroup()
			.addGroup(
				gl.createParallelGroup()
				.addComponent(currentActionLabel)
				.addComponent(currentFileLabel)
				.addComponent(currentFileProgressLabel)
				.addComponent(totalFileProgressLabel)
			)
			.addGap(20)
			.addGroup(
				gl.createParallelGroup()
				.addGroup(
					gl.createSequentialGroup()
					.addComponent(currentAction, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
					.addComponent(cancel)
				)
				.addComponent(currentFile)
				.addComponent(currentFileProgress)
				.addComponent(totalFileProgress)
			)
		)
		.addComponent(fileProgress)
		.addComponent(totalProgress)
	);
	gl.setVerticalGroup(
		gl.createSequentialGroup()
		.addGroup(
			gl.createParallelGroup(Alignment.BASELINE)
			.addComponent(currentActionLabel)
			.addComponent(currentAction)
			.addComponent(cancel)
		)
		.addGroup(
			gl.createParallelGroup(Alignment.BASELINE)
			.addComponent(currentFileLabel)
			.addComponent(currentFile)
		)
		.addGroup(
			gl.createParallelGroup(Alignment.BASELINE)
			.addComponent(currentFileProgressLabel)
			.addComponent(currentFileProgress)
		)
		.addGap(5)
		.addComponent(fileProgress)
		.addGap(5)
		.addGroup(
			gl.createParallelGroup(Alignment.BASELINE)
			.addComponent(totalFileProgressLabel)
			.addComponent(totalFileProgress)
		)
		.addGap(5)
		.addComponent(totalProgress)
	);
}