Java Code Examples for javax.swing.JLabel#setVerticalTextPosition()

The following examples show how to use javax.swing.JLabel#setVerticalTextPosition() . 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: ProgressFrame.java    From GIFKR with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void initializeComponents() {
	progressText = new JLabel(new ImageIcon(ImageTools.scaleToHeight(ImageTools.getResourceImage("iconsmall.png"), 50, false)));
	progressText.setForeground(Color.white);
	progressText.setVerticalTextPosition(JLabel.BOTTOM);
	progressText.setHorizontalTextPosition(JLabel.CENTER);
	cancelButton = new JButton("Cancel");
	
	setContentPane(new JPanel() {
		private static final long serialVersionUID = -8098561857624764691L;
		@Override
		public void paintComponent(Graphics g) {
			setOpaque(false);
			super.paintComponent(g);
			paintBG((Graphics2D) g);
		}
	});
	cancelButton.addActionListener(ae -> {if(onCancel != null) onCancel.actionPerformed(ae);});
}
 
Example 2
Source File: IncomingCall.java    From Spark with Apache License 2.0 6 votes vote down vote up
public IncomingCall() {
    setLayout(new GridBagLayout());
    setBackground(Color.white);

    callerNameLabel = new JLabel();
    callerNameLabel.setFont(new Font("Dialog", Font.BOLD, 13));
    callerNameLabel.setHorizontalAlignment(JLabel.CENTER);

    callerNumberLabel = new JLabel();
    callerNumberLabel.setFont(new Font("Dialog", Font.PLAIN, 12));
    callerNumberLabel.setHorizontalAlignment(JLabel.CENTER);


    final JLabel phoneImage = new JLabel(SparkRes.getImageIcon(SparkRes.TELEPHONE_24x24));
    phoneImage.setHorizontalAlignment(JLabel.CENTER);
    phoneImage.setVerticalTextPosition(JLabel.BOTTOM);
    phoneImage.setHorizontalTextPosition(JLabel.CENTER);
    phoneImage.setText(Res.getString("title.incoming.call"));
    phoneImage.setFont(new Font("Dialog", Font.BOLD, 16));


    add(phoneImage, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(5, 10, 0, 10), 0, 0));
    add(callerNameLabel, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 0, 0), 0, 0));
    add(callerNumberLabel, new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 10, 0), 0, 0));

}
 
Example 3
Source File: LargeIconsDisplayer.java    From knopflerfish.org with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public void addBundle0(final Bundle[] bundles) {
  if (bundles != null) {
    for (final Bundle bundle : bundles) {
      if(null == getBundleComponent(bundle)) {
        final JLabel c = createJLabelForBundle(bundle);

        c.setToolTipText(Util.bundleInfo(bundle));
        c.setVerticalTextPosition(SwingConstants.BOTTOM);
        c.setHorizontalTextPosition(SwingConstants.CENTER);

        c.setPreferredSize(new Dimension(96, 64));
        c.setBorder(null);
        c.setFont(getFont());

        bundleMap.put(new Long(bundle.getBundleId()), c);

        updateBundleComp(bundle);
      }
    }
  }
  rebuildPanel();
}
 
Example 4
Source File: OnPhone.java    From Spark with Apache License 2.0 5 votes vote down vote up
public OnPhone() {
    setLayout(new BorderLayout());

    final JPanel imagePanel = new JPanel();
    imagePanel.setLayout(new GridBagLayout());


    imagePanel.setBackground(Color.white);

    // Handle Icon Label
    iconLabel = new JLabel(SparkRes.getImageIcon(SparkRes.TELEPHONE_24x24));
    iconLabel.setHorizontalAlignment(JLabel.CENTER);
    iconLabel.setVerticalTextPosition(JLabel.BOTTOM);
    iconLabel.setHorizontalTextPosition(JLabel.CENTER);
    iconLabel.setFont(new Font("Dialog", Font.BOLD, 14));
    iconLabel.setText(Res.getString("title.on.the.phone"));

    // Handle Time Tracker
    timeLabel = new TimeTrackingLabel(new Date(), this);
    timeLabel.setOpaque(false);
    timeLabel.setHorizontalAlignment(JLabel.CENTER);
    timeLabel.setHorizontalTextPosition(JLabel.CENTER);
    timeLabel.setFont(new Font("Dialog", Font.BOLD, 14));

    // Add Icon Label
    imagePanel.add(iconLabel, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.7, GridBagConstraints.SOUTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));

    // Add Time Label
    imagePanel.add(timeLabel, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.3, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));

    add(imagePanel, BorderLayout.CENTER);
}
 
Example 5
Source File: JComponentBuilders.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected void setupInstance(JLabel instance) {
    super.setupInstance(instance);
    
    instance.setText(text);
    
    if (defaultIcon != null) instance.setIcon(defaultIcon.createInstance());
    
    instance.setVerticalAlignment(verticalAlignment);
    instance.setHorizontalAlignment(horizontalAlignment);
    instance.setVerticalTextPosition(verticalTextPosition);
    instance.setHorizontalTextPosition(horizontalTextPosition);
    instance.setIconTextGap(iconTextGap);
}
 
Example 6
Source File: JComponentBuilders.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
protected void setupInstance(JLabel instance) {
    super.setupInstance(instance);
    
    instance.setText(text);
    
    if (defaultIcon != null) instance.setIcon(defaultIcon.createInstance());
    
    instance.setVerticalAlignment(verticalAlignment);
    instance.setHorizontalAlignment(horizontalAlignment);
    instance.setVerticalTextPosition(verticalTextPosition);
    instance.setHorizontalTextPosition(horizontalTextPosition);
    instance.setIconTextGap(iconTextGap);
}
 
Example 7
Source File: VoiceMail.java    From Spark with Apache License 2.0 5 votes vote down vote up
public JPanel getToaster() {

        JPanel toaster = new JPanel();

        toaster.setLayout(new GridBagLayout());
        toaster.setBackground(Color.white);

        JLabel newVoiceMail = new JLabel();
        JLabel oldVoiceMail = new JLabel();

        newVoiceMail.setFont(new Font("Dialog", Font.BOLD, 15));
        newVoiceMail.setHorizontalAlignment(JLabel.CENTER);
        newVoiceMail.setText("New: " + this.getUnread());

        oldVoiceMail.setFont(new Font("Dialog", Font.PLAIN, 15));
        oldVoiceMail.setHorizontalAlignment(JLabel.CENTER);
        oldVoiceMail.setText("Old: " + this.getRead());

        final JLabel phoneImage = new JLabel(SparkRes
                .getImageIcon(SparkRes.MAIL_IMAGE_32x32));
        phoneImage.setHorizontalAlignment(JLabel.CENTER);
        phoneImage.setVerticalTextPosition(JLabel.BOTTOM);
        phoneImage.setHorizontalTextPosition(JLabel.CENTER);
        phoneImage.setText("Voice Mails");
        phoneImage.setFont(new Font("Dialog", Font.BOLD, 16));

        toaster.add(phoneImage, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0,
                GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
                new Insets(5, 10, 0, 10), 0, 0));
        toaster.add(newVoiceMail, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0,
                GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
                new Insets(2, 0, 0, 0), 0, 0));
        toaster.add(oldVoiceMail, new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0,
                GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
                new Insets(2, 0, 10, 0), 0, 0));

        return toaster;

    }
 
Example 8
Source File: ChatStatePanel.java    From Spark with Apache License 2.0 5 votes vote down vote up
public ChatStatePanel(ChatState state, CharSequence nickname) {
	setLayout(new FlowLayout(FlowLayout.LEFT, 1, 1));
	JLabel label = new JLabel( Res.getString( state.name(), nickname.toString() ) );
	label.setFont(new Font("Courier New", Font.PLAIN, 9));
	label.setForeground(Color.gray);
	label.setHorizontalTextPosition(JLabel.LEFT);
	label.setVerticalTextPosition(JLabel.BOTTOM);
	add( label );
}
 
Example 9
Source File: SharedFunctions.java    From zap-extensions with Apache License 2.0 4 votes vote down vote up
public static void allignLabelTop(JLabel lbl) {
    lbl.setVerticalAlignment(JLabel.TOP);
    lbl.setVerticalTextPosition(JLabel.TOP);
    lbl.setBorder(BorderFactory.createEmptyBorder(3 /* top */, 0, 0, 0));
}
 
Example 10
Source File: ActionChooserScreen.java    From chipster with MIT License 4 votes vote down vote up
public ActionChooserScreen(ImportSession importSession) {
	SwingClientApplication.setPlastic3DLookAndFeel(dialog);
	dialog.setPreferredSize(new Dimension(640, 480));
	dialog.setLocationByPlatform(true);

	this.importSession = importSession;

	table = this.getTable();
	JScrollPane scroll = new JScrollPane(table);

	// upper panel
	JLabel titleLabel = new JLabel("<html><p style=" + VisualConstants.HTML_DIALOG_TITLE_STYLE + ">" + TITLE_TEXT + "</p></html>", JLabel.LEFT);
	JLabel descriptionLabel = new JLabel("<html><p>" + INFO_TEXT + "</p></html>", JLabel.LEFT);
	GridBagConstraints c = new GridBagConstraints();
	JPanel upperPanel = new JPanel(new GridBagLayout());
	c.weightx = 1.0;
	c.weighty = 1.0;
	c.fill = GridBagConstraints.HORIZONTAL;
	c.anchor = GridBagConstraints.NORTHWEST;
	c.insets.set(10, 10, 5, 10);
	c.gridx = 0;
	c.gridy = 0;
	upperPanel.add(titleLabel, c);
	c.gridy++;
	upperPanel.add(descriptionLabel, c);
	

	// lower panel
	JPanel buttonPanel = new JPanel();
	okButton = new JButton("  OK  ");
	cancelButton = new JButton("Cancel");
	copyButton = new JButton("Apply first action to all");

	okButton.addActionListener(this);
	cancelButton.addActionListener(this);
	copyButton.addActionListener(this);

	JLabel sameSettingsLabel = new JLabel("<html><p>" + "When using Import tool to import more than one files, only define the contents of the first file and then apply the same settings for the rest of the files." + "</p></html>", JLabel.LEFT);
	sameSettingsLabel.setVerticalTextPosition(JLabel.TOP);
	//sameSettingsLabel.setPreferredSize(new Dimension(550, 40));
	
	sameSettingsCheckBox = new JCheckBox("Define file structure once and apply the same settings to all files");
	sameSettingsCheckBox.setEnabled(true);
	sameSettingsCheckBox.setSelected(true);
	sameSettingsCheckBox.setPreferredSize(new Dimension(550, 40));

	buttonPanel.setLayout(new GridBagLayout());
	GridBagConstraints g = new GridBagConstraints();
	g.anchor = GridBagConstraints.NORTHWEST;
	g.gridx = 0;
	g.gridy = 0;
	g.weightx = 0.0;

	g.insets = new Insets(5, 5, 10, 5);
	buttonPanel.add(copyButton, g);
	g.gridy++;
	buttonPanel.add(sameSettingsCheckBox, g);
	g.insets = new Insets(5, 0, 10, 5);
	g.gridy++;
	g.anchor = GridBagConstraints.EAST;
	buttonPanel.add(cancelButton, g);
	g.gridx++;
	buttonPanel.add(okButton, g);

	dialog.setLayout(new BorderLayout());
	dialog.add(upperPanel, BorderLayout.NORTH);
	dialog.add(scroll, BorderLayout.CENTER);
	dialog.add(buttonPanel, BorderLayout.SOUTH);
	dialog.pack();
	dialog.pack();
	okButton.requestFocusInWindow();
	dialog.setVisible(true);
}
 
Example 11
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 12
Source File: Editor.java    From i18n-editor with MIT License 4 votes vote down vote up
private void setupUI() {
	Color borderColor = Colors.scale(UIManager.getColor("Panel.background"), .8f);
	
	setTitle(TITLE);
	setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
	addWindowListener(new EditorWindowListener());
	
	setIconImages(Lists.newArrayList("512","256","128","64","48","32","24","20","16").stream()
			.map(size -> Images.loadFromClasspath("images/icon-" + size + ".png").getImage())
			.collect(Collectors.toList()));
	
       translationTree = new TranslationTree();
       translationTree.setBorder(BorderFactory.createEmptyBorder(0,5,0,5));
       translationTree.addTreeSelectionListener(new TranslationTreeNodeSelectionListener());
       translationTree.addMouseListener(new TranslationTreeMouseListener());
       
	translationField = new TranslationKeyField();
	translationField.addKeyListener(new TranslationFieldKeyListener());
	translationField.setBorder(BorderFactory.createCompoundBorder(
			BorderFactory.createMatteBorder(1,0,0,1,borderColor),
			((CompoundBorder)translationField.getBorder()).getInsideBorder()));
	
	JScrollPane translationsScrollPane = new JScrollPane(translationTree);
	translationsScrollPane.getViewport().setOpaque(false);
	translationsScrollPane.setOpaque(false);
	translationsScrollPane.setBorder(BorderFactory.createMatteBorder(0,0,0,1,borderColor));
	
	translationsPanel = new JPanel(new BorderLayout());
	translationsPanel.add(translationsScrollPane);
	translationsPanel.add(translationField, BorderLayout.SOUTH);
	
       resourcesPanel = new JScrollablePanel(true, false);
       resourcesPanel.setLayout(new BoxLayout(resourcesPanel, BoxLayout.Y_AXIS));
       resourcesPanel.setBorder(BorderFactory.createEmptyBorder(10,20,10,20));
       resourcesPanel.setOpaque(false);
       resourcesPanel.addMouseListener(new ResourcesPaneMouseListener());
       
       resourcesScrollPane = new JScrollPane(resourcesPanel);
       resourcesScrollPane.getViewport().setOpaque(false);
       resourcesScrollPane.setOpaque(false);
       resourcesScrollPane.setBorder(null);
       resourcesScrollPane.addMouseListener(new ResourcesPaneMouseListener());
	
	contentPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, translationsPanel, resourcesScrollPane);
	contentPane.setBorder(null);
	contentPane.setDividerSize(10);
	
	// Style the split pane divider if possible
	SplitPaneUI splitPaneUI = contentPane.getUI();
    if (splitPaneUI instanceof BasicSplitPaneUI) {
        BasicSplitPaneDivider divider = ((BasicSplitPaneUI)splitPaneUI).getDivider();
        divider.setBorder(null);
		resourcesPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,20));
    }
    
	introText = new JLabel("<html><body style=\"text-align:center; padding:30px;\">" + 
			MessageBundle.get("core.intro.text") + "</body></html>");
	introText.setOpaque(true);
	introText.setFont(introText.getFont().deriveFont(28f));
	introText.setHorizontalTextPosition(JLabel.CENTER);
	introText.setVerticalTextPosition(JLabel.BOTTOM);
	introText.setHorizontalAlignment(JLabel.CENTER);
	introText.setVerticalAlignment(JLabel.CENTER);
	introText.setForeground(getBackground().darker());
	introText.setIcon(Images.loadFromClasspath("images/icon-intro.png"));
	
	Container container = getContentPane();
	container.add(introText);
	
	editorMenu = new EditorMenuBar(this, translationTree);
	setJMenuBar(editorMenu);
}
 
Example 13
Source File: OnlyMessageBox.java    From oim-fx with MIT License 4 votes vote down vote up
private void init(String message, OnlyMessageBox.MessageType messageType, int option) {

      iconMap = new HashMap<OnlyMessageBox.MessageType, Icon>();
      iconMap.put(OnlyMessageBox.MessageType.ERROR, new ImageIcon());
      iconMap.put(OnlyMessageBox.MessageType.INFORMATION, new ImageIcon());
      iconMap.put(OnlyMessageBox.MessageType.QUESTION, new ImageIcon());
      iconMap.put(OnlyMessageBox.MessageType.WARNING, new ImageIcon());

      JPanel buttonPane = new JPanel();
      lbMessage = new JLabel(message, iconMap.get(messageType), JLabel.LEFT);
      btnOK = new JButton("确定");
      btnCancel = new JButton("取消");
      btnYes = new JButton("是");
      btnNo = new JButton("否");
      JButton[] buttons = {btnOK, btnYes, btnNo, btnCancel};
      int[] options = {OK_OPTION, YES_OPTION, NO_OPTION, CANCEL_OPTION};
      final Dimension buttonSize = new Dimension(69, 21);
      int index = 0;
      boolean hasDefaultButton = false;

     
      lbMessage.setIconTextGap(16);
      lbMessage.setHorizontalAlignment(JLabel.LEFT);
      lbMessage.setVerticalAlignment(JLabel.TOP);
      lbMessage.setVerticalTextPosition(JLabel.TOP);
      lbMessage.setBorder(new EmptyBorder(15, 25, 15, 25));
      buttonPane.setLayout(new LineLayout(6, 0, 0, 0, 0, LineLayout.LEADING, LineLayout.LEADING, LineLayout.HORIZONTAL));
      buttonPane.setPreferredSize(new Dimension(-1, 33));
      buttonPane.setBorder(new EmptyBorder(5, 9, 0, 9));
      buttonPane.setBackground(new Color(255, 255, 255, 170));

      for (JButton button : buttons) {
          button.setActionCommand(String.valueOf(options[index]));
          button.setPreferredSize(buttonSize);
          button.setVisible((option & options[index]) != 0);
          button.addActionListener(this);
          buttonPane.add(button, LineLayout.END);
          index++;

          if (!hasDefaultButton && button.isVisible()) {
              getRootPane().setDefaultButton(button);
              hasDefaultButton = true;
          }
      }

      getContentPane().setLayout(new LineLayout(0, 1, 1, 3, 1, LineLayout.LEADING, LineLayout.LEADING, LineLayout.VERTICAL));
      getContentPane().add(lbMessage, LineLayout.MIDDLE_FILL);
      getContentPane().add(buttonPane, LineLayout.END_FILL);
  }
 
Example 14
Source File: AbstractToRepositoryStep.java    From rapidminer-studio with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * Creates a panel which displays the process animation and a stop button.
 *
 * @return the created panel
 */
private JPanel createProgressPanel() {
	JPanel panel = new JPanel(new GridBagLayout());

	GridBagConstraints gbc = new GridBagConstraints();
	gbc.gridx = 0;
	gbc.gridy = 0;
	gbc.weightx = 0.0;
	gbc.weighty = 0.0;
	gbc.insets = new Insets(0, 5, 5, 5);

	ImageIcon animation = SwingTools
			.createImage(I18N.getGUILabel("io.dataimport.step.store_data_to_repository.animation"));
	animationLabel = new JLabel(animation);
	animationLabel.setHorizontalTextPosition(JLabel.CENTER);
	animationLabel.setVerticalTextPosition(JLabel.BOTTOM);

	gbc.gridy += 1;
	panel.add(animationLabel, gbc);

	stopButton = new JButton(
			new ResourceAction(true, "io.dataimport.step.store_data_to_repository.stop_data_import_progress") {

				private static final long serialVersionUID = 1L;

				@Override
				public void loggedActionPerformed(ActionEvent e) {
					if (backgroundJob != null) {
						setEnabled(false);
						backgroundJob.cancel();
						isImportCancelled = true;
					}
				}
			});

	gbc.insets = new Insets(40, 5, 5, 5);
	gbc.gridy += 1;
	panel.add(stopButton, gbc);

	return panel;
}
 
Example 15
Source File: CreditsFrame.java    From GIFKR with GNU Lesser General Public License v3.0 4 votes vote down vote up
public CreditsFrame() {
	super("Credits");
	setLayout(new GridBagLayout());
	GridBagConstraints gbc = ViewUtils.createGBC();
	gbc.fill = GridBagConstraints.HORIZONTAL;
	gbc.weighty=1;
	gbc.insets = new Insets(0, 10, 10, 10);
	
	JLabel logoLabel = new JLabel(new ImageIcon(ImageTools.scaleToHeight(ImageTools.getResourceImage("icon.png"), 100, false)));
	logoLabel.setText("<HTML>GIFKR &copy; 2017 Caleb Kussmaul");
	logoLabel.setHorizontalTextPosition(JLabel.CENTER);
	logoLabel.setVerticalTextPosition(JLabel.BOTTOM);
	
	add(logoLabel, gbc);
	
	gbc.gridy++;
	gbc.weighty=0;
	
	JTextPane dedicationPane = new JTextPane();
	
	dedicationPane.setText("Dedicated to my dad, Wes Kussmaul, for inspiring my passion for programming, creativity, and entrepreneurship.");
	dedicationPane.setOpaque(false);
	dedicationPane.setEditable(false);
	ViewUtils.centerText(dedicationPane);
	
	add(dedicationPane, gbc);
	gbc.gridy++;
	
	JTextPane copyrightPane = new JTextPane();
	copyrightPane.setText("Referenced libraries:\nOpen-Imaging under Apache 2.0\nJavaCV under Apache 2.0\nFFmpeg under LGPL 2.1");
	add(copyrightPane, gbc);
	gbc.gridy++;
	gbc.fill = GridBagConstraints.NONE;
	gbc.anchor = GridBagConstraints.CENTER;
	
	
	JCheckBox doNotShowBox = new JCheckBox("Do not show again", !GIFKRPrefs.showCreditsFrame());
	doNotShowBox.addChangeListener(ce -> {
		GIFKRPrefs.setShowCreditsFrame(!doNotShowBox.isSelected());
	});
	
	add(doNotShowBox, gbc);
	
	setSize(500, 350);
	setLocationRelativeTo(null);
	setAlwaysOnTop(true);
}
 
Example 16
Source File: VideoItemEditor.java    From xdm with GNU General Public License v2.0 4 votes vote down vote up
public VideoItemEditor(MediaImageSource imgSource) {
	component = new JPanel(new BorderLayout(getScaledInt(5), getScaledInt(5)));
	component.setBorder(new EmptyBorder(0, getScaledInt(5), getScaledInt(5), getScaledInt(5)));
	panel = new JPanel(new BorderLayout());
	lbl = new JLabel();
	lbl.setVerticalAlignment(JLabel.CENTER);
	lbl.setVerticalTextPosition(JLabel.CENTER);
	lbl.setFont(FontResource.getBigFont());
	lblIcon = new JLabel();
	lblIcon.setOpaque(true);
	lblIcon.setMinimumSize(new Dimension(getScaledInt(119), getScaledInt(92)));
	lblIcon.setMaximumSize(new Dimension(getScaledInt(119), getScaledInt(92)));
	lblIcon.setPreferredSize(new Dimension(getScaledInt(119), getScaledInt(92)));
	lblIcon.setHorizontalAlignment(JLabel.CENTER);
	ico = ImageResource.getIcon("videoplay.png",94,92);
	lblIcon.setIcon(ico);
	// lblIcon.setBorder(new EmptyBorder(12, 5, 5, 5));
	lblIcon.setVerticalAlignment(JLabel.CENTER);
	// lblIcon.setPreferredSize(new Dimension(53, 53));

	JPanel p1 = new JPanel(new BorderLayout());
	p1.setOpaque(false);
	p1.add(lblIcon);
	chk = new JCheckBox("");
	chk.setOpaque(false);
	chk.setIcon(ImageResource.getIcon("unchecked.png",16,16));
	chk.setSelectedIcon(ImageResource.getIcon("checked.png",16,16));
	p1.add(chk, BorderLayout.WEST);
	p1.setBorder(new EmptyBorder(getScaledInt(12), 0, getScaledInt(5), getScaledInt(5)));
	component.add(p1, BorderLayout.WEST);
	cmbModel = new DefaultComboBoxModel<>();
	cmb = new JComboBox<>(cmbModel);
	cmb.setPreferredSize(new Dimension(getScaledInt(200), getScaledInt(30)));
	cmb.setOpaque(false);
	cmb.setBorder(null);
	panel.add(lbl);
	panel.add(cmb, BorderLayout.SOUTH);
	panel.setOpaque(false);
	panel.setBorder(new EmptyBorder(0, 0, getScaledInt(5), getScaledInt(5)));
	component.add(panel);
	lblBorder = new JLabel();
	lblBorder.setPreferredSize(new Dimension(getScaledInt(100), 1));
	lblBorder.setMaximumSize(new Dimension(getScaledInt(100), 1));
	lblBorder.setBackground(ColorResource.getDarkerBgColor());
	component.add(lblBorder, BorderLayout.NORTH);
	component.setOpaque(false);
	this.imgSource = imgSource;
	// component.setBackground(ColorResource.getSelectionColor());
}
 
Example 17
Source File: DialPanel.java    From Spark with Apache License 2.0 3 votes vote down vote up
public DialPanel() {
    setLayout(new GridBagLayout());

    JPanel imagePanel = new JPanel();
    imagePanel.setLayout(new BorderLayout());


    imagePanel.setBackground(Color.white);

    iconLabel = new JLabel(SparkRes.getImageIcon(SparkRes.TELEPHONE_24x24));
    iconLabel.setHorizontalAlignment(JLabel.CENTER);
    iconLabel.setVerticalTextPosition(JLabel.BOTTOM);
    iconLabel.setHorizontalTextPosition(JLabel.CENTER);
    imagePanel.add(iconLabel, BorderLayout.CENTER);
    iconLabel.setFont(new Font("Dialog", Font.BOLD, 14));


    dialPanel.setLayout(new GridBagLayout());

    JLabel dialLabel = new JLabel();
    dialPanel.add(dialLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.WEST, new Insets(5, 5, 5, 5), 0, 0));

    dialField = new JTextField();
    dialPanel.add(dialField, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));

    dialButton = new JButton("");
    dialPanel.add(dialButton, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.WEST, new Insets(5, 5, 5, 5), 0, 0));

    add(imagePanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    add(dialPanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));

    iconLabel.setText(Res.getString("title.waiting.to.call"));

    ResourceUtils.resButton(dialButton, Res.getString("label.dial"));
    ResourceUtils.resLabel(dialLabel, dialField, Res.getString("label.number") + ":");
}