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

The following examples show how to use javax.swing.JLabel#setBounds() . These examples are extracted from open source projects. 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
public ShowTextDialog(String value, ImageInfoReader imageInfoReader, SoundIdReader soundIdReader, JFrame parentFrame) {
	super(500, 160, imageInfoReader);
	
	JLabel label = JLabelFactory.createJLabel(value);
	label.setBounds(16, 16, 465, 50);
	addComponent(label);
	
	JPanel buttonPane = new JPanel();
	buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
	buttonPane.setOpaque(false);
	buttonPane.setBounds(16, 100, 465, 50);
	addComponent(buttonPane);

	JButton okButton = JButtonFactory.createButton(" OK ", imageInfoReader, soundIdReader);
	okButton.setActionCommand("OK");
	buttonPane.add(okButton);
	getRootPane().setDefaultButton(okButton);

	addActions(okButton);
	DialogUtils.createDialogBackPanel(this, parentFrame.getContentPane());
}
 
Example 2
private void addPerformancePanel(KeyBindings keyBindings) {
	JPanel performancePanel = JPanelFactory.createJPanel("Performance");
	performancePanel.setOpaque(false);
	performancePanel.setBounds(15, 310, 368, 100);
	performancePanel.setLayout(null);
	
	JLabel lblAnimationSpeed = JLabelFactory.createJLabel("Animation Speed:");
	lblAnimationSpeed.setToolTipText(ANIMATION_SPEED_TOOL_TIP);
	lblAnimationSpeed.setOpaque(false);
	lblAnimationSpeed.setBounds(12, 25, 137, 25);
	performancePanel.add(lblAnimationSpeed);

	JComboBox<AnimationSpeed> cmbAnimationSpeed = JComboBoxFactory.createJComboBox(AnimationSpeed.values(), imageInfoReader);
	cmbAnimationSpeed.setForeground(Color.BLACK);
	cmbAnimationSpeed.setToolTipText(ANIMATION_SPEED_TOOL_TIP);
	cmbAnimationSpeed.setSelectedItem(keyBindings.getAnimationSpeed());
	cmbAnimationSpeed.setOpaque(false);
	cmbAnimationSpeed.setBounds(228, 25, 127, 25);
	performancePanel.add(cmbAnimationSpeed);
	
	cmbAnimationSpeed.addActionListener(e -> keyBindings.setAnimationSpeed((AnimationSpeed)cmbAnimationSpeed.getSelectedItem()));
	
	addComponent(performancePanel);
}
 
Example 3
Source Project: dkpro-jwpl   File: ModePanel.java    License: Apache License 2.0 5 votes vote down vote up
private void createMinimumCommonSequenceSettings()
{

	minimumCommonSequenceLabel = new JLabel(
			"Min lenght of a common subsequence:");
	minimumCommonSequenceLabel.setBorder(BorderFactory
			.createRaisedBevelBorder());
	minimumCommonSequenceLabel.setBounds(10, 50, 270, 25);
	this.add(minimumCommonSequenceLabel);

	minimumCommonSequenceField = new JTextField();
	minimumCommonSequenceField.setBounds(290, 50, 100, 25);
	this.add(minimumCommonSequenceField);
}
 
Example 4
private void ShowTitle() {

        JLabel includedFractions_label = new javax.swing.JLabel();
        includedFractions_label.setBackground(new java.awt.Color(102, 102, 102));
        includedFractions_label.setForeground(new java.awt.Color(255, 255, 255));
        includedFractions_label.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        includedFractions_label.setText("Included Fractions");
        includedFractions_label.setBorder(
                javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        includedFractions_label.setOpaque(true);
        includedFractions_label.setBounds(0, 0, getWidth(), 18);
        add(includedFractions_label, javax.swing.JLayeredPane.DEFAULT_LAYER);

    }
 
Example 5
/**
 * Creates the crs list.
 *
 * @param label the label
 * @param xPos the x pos
 * @param fieldPanel the field panel
 * @param row the row
 * @return the value combo box
 */
private ValueComboBox createCRSList(String label, int xPos, FieldPanel fieldPanel, int row) {
    JLabel lbl = new JLabel(label);
    lbl.setHorizontalAlignment(SwingConstants.TRAILING);
    lbl.setBounds(xPos, getRowY(row), BasePanel.LABEL_WIDTH, BasePanel.WIDGET_HEIGHT);
    fieldPanel.add(lbl);

    // Populate data list
    List<ValueComboBoxData> crsDataList = CoordManager.getInstance().getCRSList();
    crsComboBox = new ValueComboBox();
    crsComboBox.initialiseSingle(crsDataList);
    crsComboBox.setBounds(
            xPos + BasePanel.WIDGET_X_START,
            getRowY(row),
            this.isValueOnly()
                    ? BasePanel.WIDGET_EXTENDED_WIDTH
                    : BasePanel.WIDGET_STANDARD_WIDTH,
            BasePanel.WIDGET_HEIGHT);
    fieldPanel.add(crsComboBox);
    crsComboBox.addActionListener(
            new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    valueUpdated();
                }
            });
    return crsComboBox;
}
 
Example 6
Source Project: ET_Redux   File: SesarSampleManager.java    License: Apache License 2.0 5 votes vote down vote up
private JLabel labelFactory(String text, int x, int y, int width) {
    JLabel label = new JLabel(text);
    label.setBounds(x, y, width, ROW_HEIGHT);
    label.setFont(ReduxConstants.sansSerif_12_Bold);
    label.setHorizontalAlignment(RIGHT);

    return label;
}
 
Example 7
Source Project: ET_Redux   File: AbstractValueModelView.java    License: Apache License 2.0 5 votes vote down vote up
/**
 *
 *
 * @param valueModel
 */
public AbstractValueModelView ( ValueModel valueModel ) {

    this.valueModel = valueModel;

    valueTextBox = new JTextField();
    valueTextBox.setBounds( 110, 0, 185, PANEL_HEIGHT );
    this.add( valueTextBox );

    uncertaintyTextBox = new JTextField();
    uncertaintyTextBox.setBounds( 300, 0, 185, PANEL_HEIGHT );
    this.add( uncertaintyTextBox );

    valueModelNameLabel = new JLabel( RatioNamePrettyPrinter.makePrettyHTMLString( valueModel.getName() ) );
    valueModelNameLabel.setBounds( //
            0, //
            0, //
            100, //
            PANEL_HEIGHT );
    valueModelNameLabel.setHorizontalAlignment( SwingConstants.RIGHT );
    valueModelNameLabel.setFont(ReduxConstants.sansSerif_12_Bold );
    this.add( valueModelNameLabel );

    showOneSigmaAsPerCent = false;

    this.setBounds( 0, 0, PANEL_WIDTH, PANEL_HEIGHT );
}
 
Example 8
public NowPlayingNotification(final String title, final String artist,
		final String artURL) throws MalformedURLException {
	getContentPane().setBackground(Color.DARK_GRAY);
	getContentPane().setLayout(null);

	final JLabel mediaArtLabel = new JLabel("");
	final URL where = new URL(artURL);
	final ImageIcon anotherIcon = new ImageIcon(where);
	mediaArtLabel.setIcon(new ImageIcon(((anotherIcon.getImage())
			.getScaledInstance(84, 65, Image.SCALE_SMOOTH))));

	mediaArtLabel.setBounds(0, 0, 84, 65);
	getContentPane().add(mediaArtLabel);

	final JLabel nowPlayingLabel = new JLabel("Now Playing:");
	nowPlayingLabel.setFont(new Font("Segoe UI", Font.PLAIN, 13));
	nowPlayingLabel.setForeground(Color.WHITE);
	nowPlayingLabel.setHorizontalAlignment(SwingConstants.LEFT);
	nowPlayingLabel.setBounds(94, 0, 156, 14);
	getContentPane().add(nowPlayingLabel);
	final String information = String.format(
			"<html><strong>%s</strong><br>%s</html>", title, artist);
	final JLabel informationLabel = new JLabel(information);
	informationLabel.setFont(new Font("Segoe UI", Font.BOLD, 12));
	informationLabel.setForeground(Color.LIGHT_GRAY);
	informationLabel.setHorizontalAlignment(SwingConstants.LEFT);
	informationLabel.setBounds(94, 14, 156, 51);
	getContentPane().add(informationLabel);
	setSize(250, 65);
	// positionWindow();
	setAlwaysOnTop(true);
	setVisible(true);
}
 
Example 9
/**
 * Internal create label.
 *
 * @param xPos the x pos
 * @param yOffset the y offset
 * @param label the label
 */
private void internalCreateLabel(int xPos, int yOffset, String label) {
    JLabel lblLabel = new JLabel(label);
    lblLabel.setBounds(xPos + 5, yOffset, BasePanel.LABEL_WIDTH, BasePanel.WIDGET_HEIGHT);
    lblLabel.setHorizontalAlignment(SwingConstants.TRAILING);

    add(lblLabel);
}
 
Example 10
/**
 *
 */
public AbstractDataMonitorView() {
    super();

    myReduxIcon = new CustomIcon(imageReduxURL);
    redux_Icon_label = new JLabel();
    redux_Icon_label.setBounds(leftMargin + 5, 5, 78, 50);
    ((CustomIcon) myReduxIcon).setSize(redux_Icon_label.getWidth(), redux_Icon_label.getHeight());
    redux_Icon_label.setIcon(myReduxIcon);
}
 
Example 11
Source Project: knife   File: ComBoxEditor.java    License: MIT License 5 votes vote down vote up
public ComBoxEditor()
{
	m_ComboBox = new JComboBox();
	m_ComboBox.addItem("选项A");
	m_ComboBox.addItem("选项B");
	m_ComboBox.addItem("选项C");
	
	m_ComboBox.setSize(100,30);
	
	m_OutLable= new JLabel();
	m_OutLable.setLayout(null);
	m_OutLable.setBounds(0, 0, 120, 40);
	m_OutLable.add(m_ComboBox);
	m_ComboBox.setLocation(50, 50);
	
	//响应下拉列表的事件
	m_ComboBox.addItemListener(new ItemListener()
	{
		@Override
		public void itemStateChanged(ItemEvent e)
		{
			System.out.println("下拉列表的选中事件");
			if(e.getStateChange() == e.SELECTED)
			{
				//获取选择的值
				m_SelStr = (String)m_ComboBox.getSelectedItem();
				//结束选择
				fireEditingStopped();
			}
		}
	});
}
 
Example 12
private void setStars() {
    int locationPoint = 390;
    for (int i = 0; i < 5; i++) {
        stars = new JLabel("");
        stars.setHorizontalTextPosition(SwingConstants.CENTER);
        stars.setHorizontalAlignment(SwingConstants.CENTER);
        stars.setIcon(new ImageIcon(HotelPropertiesWindow.class.getResource("/com/coder/hms/icons/hotel_external_star.png")));
        stars.setBounds(locationPoint, 19, 46, 37);
        stars.setVisible(false);
        starHolder.add(stars);

        starlabels[i] = stars;
        locationPoint = locationPoint + 44;
    }
}
 
Example 13
private void createFamilyPanel(WorldObject playerCharacter, ImageInfoReader imageInfoReader, World world, int infoPanelWidth, int infoPanelHeight, JPanel infoPanel) {
	JPanel familyPanel = JPanelFactory.createJPanel("Family");
	familyPanel.setLayout(null);
	familyPanel.setBounds(12, 13, infoPanelWidth + 5, infoPanelHeight);
	infoPanel.add(familyPanel, FAMILY_KEY);
	
	JLabel lblMate = JLabelFactory.createJLabel("Mate:");
	lblMate.setToolTipText(MATE_TOOLTIP);
	lblMate.setBounds(12, 30, 109, 16);
	familyPanel.add(lblMate);
			
	JLabel lblMateValue = JLabelFactory.createJLabel("<no mate>");
	lblMateValue.setToolTipText(MATE_TOOLTIP);
	Integer mateId = playerCharacter.getProperty(Constants.MATE_ID);
	if (mateId != null) {
		WorldObject mate = world.findWorldObjectById(mateId);
		lblMateValue.setIcon(new ImageIcon(imageInfoReader.getImage(mate.getProperty(Constants.IMAGE_ID), null)));
		lblMateValue.setText(mate.getProperty(Constants.NAME));
	}
	
	lblMateValue.setBounds(149, 30, 180, 16);
	familyPanel.add(lblMateValue);
	
	JLabel lblChildren = JLabelFactory.createJLabel("Children:");
	lblChildren.setToolTipText(CHILDREN_TOOLTIP);
	lblChildren.setBounds(12, 60, 109, 16);
	familyPanel.add(lblChildren);
	
	tlbChildren = JTableFactory.createJTable(new ChildrenTableModel(playerCharacter, world));
	tlbChildren.setDefaultRenderer(ImageIds.class, new ImageTableRenderer(imageInfoReader));
	tlbChildren.setRowHeight(50);
	tlbChildren.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
	tlbChildren.setAutoCreateRowSorter(true);
	tlbChildren.getColumnModel().getColumn(0).setPreferredWidth(50);
	tlbChildren.getColumnModel().getColumn(1).setPreferredWidth(405);
	tlbChildren.setToolTipText(CHILDREN_TOOLTIP);
	JScrollPane scrollPaneChildren = JScrollPaneFactory.createScrollPane(tlbChildren);
	scrollPaneChildren.setBounds(13, 100, 525, 420);
	familyPanel.add(scrollPaneChildren);
	SwingUtils.makeTransparant(tlbChildren, scrollPaneChildren);
}
 
Example 14
public PinPadPanelImpl() {
   this.setLayout((LayoutManager)null);
   Toolkit toolkit = this.getToolkit();
   toolkit.addAWTEventListener(new PinPadPanelImpl.KeyBoardAWTEventListener(), 8L);
   Font fntButton = new Font("Arial", 1, 35);
   Font fntLabel = new Font("Arial", 1, 12);
   Font fntField = new Font("Arial", 1, 35);
   Color clrGreen = new Color(128, 175, 60);
   Color clrRed = Color.red;
   Insets marginButton = new Insets(0, 0, 0, 0);
   this.add(this.createButton("1", fntButton, marginButton, new Rectangle(22, 126, 75, 50)));
   this.add(this.createButton("2", fntButton, marginButton, new Rectangle(104, 126, 75, 50)));
   this.add(this.createButton("3", fntButton, marginButton, new Rectangle(192, 126, 75, 50)));
   this.add(this.createButton("4", fntButton, marginButton, new Rectangle(22, 187, 75, 50)));
   this.add(this.createButton("5", fntButton, marginButton, new Rectangle(104, 187, 75, 50)));
   this.add(this.createButton("6", fntButton, marginButton, new Rectangle(192, 187, 75, 50)));
   this.add(this.createButton("7", fntButton, marginButton, new Rectangle(22, 250, 75, 50)));
   this.add(this.createButton("8", fntButton, marginButton, new Rectangle(104, 250, 75, 50)));
   this.add(this.createButton("9", fntButton, marginButton, new Rectangle(192, 250, 75, 50)));
   this.add(this.createButton("0", fntButton, marginButton, new Rectangle(22, 311, 75, 50)));
   this.add(this.createButton("<", fntButton, marginButton, new Rectangle(104, 311, 75, 50), new ActionListener() {
      public void actionPerformed(ActionEvent e) {
         PinPadPanelImpl.this.processBackspace();
      }
   }));
   this.btnGo = new JButton("GO");
   this.btnGo.setForeground(clrGreen);
   this.btnGo.setMargin(marginButton);
   this.btnGo.setFont(fntButton);
   this.btnGo.setBounds(192, 311, 75, 50);
   this.btnGo.setEnabled(false);
   this.add(this.btnGo);
   this.txtPassWord = new JPasswordField();
   this.txtPassWord.setHorizontalAlignment(0);
   this.txtPassWord.setFocusable(false);
   this.txtPassWord.setFont(fntField);
   this.txtPassWord.setText("");
   this.txtPassWord.setBorder(new LineBorder(Color.GRAY, 1, true));
   this.txtPassWord.setBounds(22, 65, 245, 50);
   this.add(this.txtPassWord);
   JLabel lblPinCode = new JLabel("Please enter your pincode to authenticate yourself.");
   lblPinCode.setFont(fntLabel);
   lblPinCode.setBounds(22, 40, 245, 14);
   this.add(lblPinCode);
   this.setFocusable(true);
   this.lblRetriesleft = new JLabel("Retries left: ");
   this.lblRetriesleft.setFont(fntLabel);
   this.lblRetriesleft.setForeground(clrRed);
   this.lblRetriesleft.setBounds(22, 15, 245, 14);
   this.lblRetriesleft.setVisible(false);
   this.add(this.lblRetriesleft);
}
 
Example 15
public PinPadPanelImpl() {
   this.setLayout((LayoutManager)null);
   Toolkit toolkit = this.getToolkit();
   toolkit.addAWTEventListener(new PinPadPanelImpl.KeyBoardAWTEventListener(null), 8L);
   Font fntButton = new Font("Arial", 1, 35);
   Font fntLabel = new Font("Arial", 1, 12);
   Font fntField = new Font("Arial", 1, 35);
   Color clrGreen = new Color(128, 175, 60);
   Color clrRed = Color.red;
   Insets marginButton = new Insets(0, 0, 0, 0);
   this.add(this.createButton("1", fntButton, marginButton, new Rectangle(22, 126, 75, 50)));
   this.add(this.createButton("2", fntButton, marginButton, new Rectangle(104, 126, 75, 50)));
   this.add(this.createButton("3", fntButton, marginButton, new Rectangle(192, 126, 75, 50)));
   this.add(this.createButton("4", fntButton, marginButton, new Rectangle(22, 187, 75, 50)));
   this.add(this.createButton("5", fntButton, marginButton, new Rectangle(104, 187, 75, 50)));
   this.add(this.createButton("6", fntButton, marginButton, new Rectangle(192, 187, 75, 50)));
   this.add(this.createButton("7", fntButton, marginButton, new Rectangle(22, 250, 75, 50)));
   this.add(this.createButton("8", fntButton, marginButton, new Rectangle(104, 250, 75, 50)));
   this.add(this.createButton("9", fntButton, marginButton, new Rectangle(192, 250, 75, 50)));
   this.add(this.createButton("0", fntButton, marginButton, new Rectangle(22, 311, 75, 50)));
   this.add(this.createButton("<", fntButton, marginButton, new Rectangle(104, 311, 75, 50), new ActionListener() {
      public void actionPerformed(ActionEvent e) {
         PinPadPanelImpl.this.processBackspace();
      }
   }));
   this.btnGo = new JButton("GO");
   this.btnGo.setForeground(clrGreen);
   this.btnGo.setMargin(marginButton);
   this.btnGo.setFont(fntButton);
   this.btnGo.setBounds(192, 311, 75, 50);
   this.btnGo.setEnabled(false);
   this.add(this.btnGo);
   this.txtPassWord = new JPasswordField();
   this.txtPassWord.setHorizontalAlignment(0);
   this.txtPassWord.setFocusable(false);
   this.txtPassWord.setFont(fntField);
   this.txtPassWord.setText("");
   this.txtPassWord.setBorder(new LineBorder(Color.GRAY, 1, true));
   this.txtPassWord.setBounds(22, 65, 245, 50);
   this.add(this.txtPassWord);
   JLabel lblPinCode = new JLabel("Please enter your pincode to authenticate yourself.");
   lblPinCode.setFont(fntLabel);
   lblPinCode.setBounds(22, 40, 245, 14);
   this.add(lblPinCode);
   this.setFocusable(true);
   this.lblRetriesleft = new JLabel("Retries left: ");
   this.lblRetriesleft.setFont(fntLabel);
   this.lblRetriesleft.setForeground(clrRed);
   this.lblRetriesleft.setBounds(22, 15, 245, 14);
   this.lblRetriesleft.setVisible(false);
   this.add(this.lblRetriesleft);
}
 
Example 16
private void init() {
	setUndecorated(true);

	try {
		if (GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice()
				.isWindowTranslucencySupported(WindowTranslucency.TRANSLUCENT)) {
			if (!Config.getInstance().isNoTransparency())
				setOpacity(0.85f);
		}
	} catch (Exception e) {
		Logger.log(e);
	}

	setIconImage(ImageResource.getImage("icon.png"));
	setSize(getScaledInt(350), getScaledInt(200));
	setLocationRelativeTo(null);
	setResizable(false);

	getContentPane().setLayout(null);
	getContentPane().setBackground(ColorResource.getDarkestBgColor());

	titlePanel = new TitlePanel(null, this);
	titlePanel.setOpaque(false);
	titlePanel.setBounds(0, 0, getScaledInt(350), getScaledInt(50));

	closeBtn = new CustomButton();
	closeBtn.setBounds(getScaledInt(320), getScaledInt(5), getScaledInt(24), getScaledInt(24));
	closeBtn.setIcon(ImageResource.getIcon("title_close.png",20,20));
	closeBtn.setBackground(ColorResource.getDarkestBgColor());
	closeBtn.setBorderPainted(false);
	closeBtn.setFocusPainted(false);
	closeBtn.setName("CLOSE");
	closeBtn.addActionListener(this);

	minBtn = new CustomButton();
	minBtn.setBounds(getScaledInt(296), getScaledInt(5), getScaledInt(24), getScaledInt(24));
	minBtn.setIcon(ImageResource.getIcon("title_min.png",20,20));
	minBtn.setBackground(ColorResource.getDarkestBgColor());
	minBtn.setBorderPainted(false);
	minBtn.setFocusPainted(false);
	minBtn.setName("MIN");
	minBtn.addActionListener(this);

	titleLbl = new JLabel(StringResource.get("TITLE_CONVERT"));
	titleLbl.setFont(FontResource.getBiggerFont());
	titleLbl.setForeground(ColorResource.getSelectionColor());
	titleLbl.setBounds(getScaledInt(25), getScaledInt(15), getScaledInt(250), getScaledInt(30));

	JLabel lineLbl = new JLabel();
	lineLbl.setBackground(ColorResource.getSelectionColor());
	lineLbl.setBounds(0, getScaledInt(55), getScaledInt(400), 2);
	lineLbl.setOpaque(true);

	prg = new JProgressBar();
	prg.setBounds(getScaledInt(20), getScaledInt(85), getScaledInt(350) - getScaledInt(40), getScaledInt(5));

	statLbl = new JLabel();
	statLbl.setForeground(Color.WHITE);
	statLbl.setBounds(getScaledInt(20), getScaledInt(100), getScaledInt(350) - getScaledInt(40), getScaledInt(25));

	titlePanel.add(titleLbl);
	titlePanel.add(minBtn);
	titlePanel.add(closeBtn);

	add(lineLbl);
	add(titlePanel);
	add(prg);
	add(statLbl);

	panel = new JPanel(null);
	panel.setBounds(0, getScaledInt(150), getScaledInt(350), getScaledInt(50));
	panel.setBackground(Color.DARK_GRAY);

	btnCN = new CustomButton(StringResource.get("MENU_PAUSE"));
	btnCN.setBounds(0, 1, getScaledInt(350), getScaledInt(50));
	btnCN.setName("CLOSE");
	applyStyle(btnCN);
	panel.add(btnCN);
	add(panel);
}
 
Example 17
private void init() {
	setUndecorated(true);

	try {
		if (GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice()
				.isWindowTranslucencySupported(WindowTranslucency.TRANSLUCENT)) {
			if (!Config.getInstance().isNoTransparency())
				setOpacity(0.85f);
		}
	} catch (Exception e) {
		Logger.log(e);
	}

	setIconImage(ImageResource.getImage("icon.png"));
	setSize(getScaledInt(350), getScaledInt(200));
	setLocationRelativeTo(null);
	setResizable(false);

	getContentPane().setLayout(null);
	getContentPane().setBackground(ColorResource.getDarkestBgColor());

	titlePanel = new TitlePanel(null, this);
	titlePanel.setOpaque(false);
	titlePanel.setBounds(0, 0, getScaledInt(350), getScaledInt(50));

	closeBtn = new CustomButton();
	closeBtn.setBounds(getScaledInt(320), getScaledInt(5), getScaledInt(24), getScaledInt(24));
	closeBtn.setIcon(ImageResource.getIcon("title_close.png",20,20));
	closeBtn.setBackground(ColorResource.getDarkestBgColor());
	closeBtn.setBorderPainted(false);
	closeBtn.setFocusPainted(false);
	closeBtn.setName("CLOSE");
	closeBtn.addActionListener(this);

	minBtn = new CustomButton();
	minBtn.setBounds(getScaledInt(296), getScaledInt(5), getScaledInt(24), getScaledInt(24));
	minBtn.setIcon(ImageResource.getIcon("title_min.png",20,20));
	minBtn.setBackground(ColorResource.getDarkestBgColor());
	minBtn.setBorderPainted(false);
	minBtn.setFocusPainted(false);
	minBtn.setName("MIN");
	minBtn.addActionListener(this);

	titleLbl = new JLabel(StringResource.get("TITLE_CONVERT"));
	titleLbl.setFont(FontResource.getBiggerFont());
	titleLbl.setForeground(ColorResource.getSelectionColor());
	titleLbl.setBounds(getScaledInt(25), getScaledInt(15), getScaledInt(250), getScaledInt(30));

	JLabel lineLbl = new JLabel();
	lineLbl.setBackground(ColorResource.getSelectionColor());
	lineLbl.setBounds(0, getScaledInt(55), getScaledInt(400), 2);
	lineLbl.setOpaque(true);

	prg = new JProgressBar();
	prg.setBounds(getScaledInt(20), getScaledInt(85), getScaledInt(350) - getScaledInt(40), getScaledInt(5));

	statLbl = new JLabel();
	statLbl.setForeground(Color.WHITE);
	statLbl.setBounds(getScaledInt(20), getScaledInt(100), getScaledInt(350) - getScaledInt(40), getScaledInt(25));

	titlePanel.add(titleLbl);
	titlePanel.add(minBtn);
	titlePanel.add(closeBtn);

	add(lineLbl);
	add(titlePanel);
	add(prg);
	add(statLbl);

	panel = new JPanel(null);
	panel.setBounds(getScaledInt(0), getScaledInt(150), getScaledInt(350), getScaledInt(50));
	panel.setBackground(Color.DARK_GRAY);

	btnCN = new CustomButton(StringResource.get("MENU_PAUSE"));
	btnCN.setBounds(0, 1, getScaledInt(350), getScaledInt(50));
	btnCN.setName("CLOSE");
	applyStyle(btnCN);
	panel.add(btnCN);
	add(panel);
}
 
Example 18
Source Project: Java   File: MainFrame.java    License: Artistic License 2.0 4 votes vote down vote up
private void dateUI() {
	// ǽ��ʼ��
	for (int i = 0; i < dates.length; i++) {
		for (int j = 0; j < dates[i].length; j++) {
			if (dates[i][j] == 1) {
				JLabel temp = new JLabel(new ImageIcon("1.png"));
				temp.setBounds(10 + j * 50, 10 + i * 50, 50, 50);
				this.panel.add(temp);
			}
		}
	}
	// �����ʼλ�õ�3�У���3��(���ڵ�0�е�0��)
	this.playerX = 3;
	this.playerY = 3;
	player = new JLabel(new ImageIcon("-10.png"));
	player.setBounds(10 + playerX * 50, 10 + playerY * 50, 50, 50);
	this.panel.add(player);

	// Ŀ���ʼ��
	// ��total�й�
	JLabel tar1 = new JLabel(new ImageIcon("8.png"));
	tar1.setBounds(10 + 14 * 50, 10 + 5 * 50, 50, 50);
	this.panel.add(tar1);
	dates[5][14] = LogicHelper.TARGET;
	uis[5][14] = tar1;
	JLabel tar2 = new JLabel(new ImageIcon("8.png"));
	tar2.setBounds(10 + 14 * 50, 10 + 6 * 50, 50, 50);
	this.panel.add(tar2);
	dates[6][14] = LogicHelper.TARGET;
	uis[6][14] = tar2;
	JLabel tar3 = new JLabel(new ImageIcon("8.png"));
	tar3.setBounds(10 + 14 * 50, 10 + 7 * 50, 50, 50);
	this.panel.add(tar3);
	dates[7][14] = LogicHelper.TARGET;
	uis[7][14] = tar3;

	// ���ӳ�ʼ��
	// ��total�й�
	JLabel box1 = new JLabel(new ImageIcon("4.png"));
	box1.setBounds(10 + 7 * 50, 10 + 3 * 50, 50, 50);
	this.panel.add(box1);
	dates[3][7] = LogicHelper.BOX;
	uis[3][7] = box1;
	JLabel box2 = new JLabel(new ImageIcon("4.png"));
	box2.setBounds(10 + 7 * 50, 10 + 5 * 50, 50, 50);
	this.panel.add(box2);
	dates[5][7] = LogicHelper.BOX;
	uis[5][7] = box2;
	JLabel box3 = new JLabel(new ImageIcon("4.png"));
	box3.setBounds(10 + 7 * 50, 10 + 7 * 50, 50, 50);
	this.panel.add(box3);
	dates[7][7] = LogicHelper.BOX;
	uis[7][7] = box3;

}
 
Example 19
@Override
protected void initComponents() {
	// Features
	final int marginLeft = 23;
	this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
	this.setResizable(false);
	getContentPane().setLayout(new BorderLayout());
	JPanel panel = new JPanel();
	panel.setLayout(null);
	panel.setPreferredSize(new Dimension(getWidth(), getHeight() + 140));
	panel.setBackground(parent.getBackground());
	JScrollPane scroll = new JScrollPane(panel,
			JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
			JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
	getContentPane().add(scroll);

	// Title
	final String title = I18N.getHtmlText("PanelOutput.border.text");
	setTitle(I18N.getText("Window.name.text"));
	JLabel lblTitle = new JLabel(title);
	lblTitle.setFont(new Font("Lucida", Font.BOLD, 20));
	lblTitle.setBounds(marginLeft, 21, 435, 25);
	panel.add(lblTitle);

	// Content
	JLabel lblContent01 = new JLabel(
			I18N.getHtmlText("HelpPlayerDialog.help.01"));
	lblContent01.setBounds(marginLeft, 50, 435, 120);
	panel.add(lblContent01);

	JButton lblContent02 = new UrlButton(I18N.getHtmlText(
			"HelpPlayerDialog.help.02", Html.LINK), parent.getCursor(),
			parent.getBackground(), new Rectangle(marginLeft + 20, 170,
					240, 20));
	panel.add(lblContent02);

	UrlButton lblContent03 = new UrlButton(I18N.getHtmlText(
			"HelpPlayerDialog.help.03", Html.LINK), parent.getCursor(),
			parent.getBackground(), new Rectangle(marginLeft + 20, 190,
					240, 20));
	panel.add(lblContent03);

	UrlButton lblContent04 = new UrlButton(I18N.getHtmlText(
			"HelpPlayerDialog.help.04", Html.LINK), parent.getCursor(),
			parent.getBackground(), new Rectangle(marginLeft + 20, 210,
					240, 20));
	panel.add(lblContent04);

	JLabel lblContent05 = new JLabel(
			I18N.getHtmlText("HelpPlayerDialog.help.05"));
	lblContent05.setBounds(marginLeft, 230, 435, 180);
	panel.add(lblContent05);

	JLabel lblContent06 = new JLabel(
			I18N.getHtmlText("HelpPlayerDialog.help.06"));
	lblContent06.setBounds(marginLeft, 410, 435, 100);
	panel.add(lblContent06);

	JLabel lblContent07 = new JLabel(
			I18N.getHtmlText("HelpPlayerDialog.help.07"));
	lblContent07.setBounds(marginLeft + 20, 510, 415, 40);
	panel.add(lblContent07);

	// Borders (for debug purposes)
	if (log.isTraceEnabled()) {
		Border border = BorderFactory.createLineBorder(Color.black);
		lblTitle.setBorder(border);
		lblContent01.setBorder(border);
		lblContent02.setBorderPainted(true);
		lblContent02.setBorder(border);
		lblContent03.setBorder(border);
		lblContent03.setBorderPainted(true);
		lblContent04.setBorder(border);
		lblContent04.setBorderPainted(true);
		lblContent05.setBorder(border);
		lblContent06.setBorder(border);
		lblContent07.setBorder(border);
		panel.setBorder(border);
	}
}
 
Example 20
Source Project: Java-MP3-player   File: PlayerTest.java    License: MIT License 4 votes vote down vote up
void google() {
	btnGoogleIt_1 = new RoundButton("Google it!");
	btnGoogleIt_1.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent e) {
			try {
				String f1 = "", f2 = "", f3 = "";
				if (mediaPlayer == null) {
					JOptionPane.showMessageDialog(null, "Please play a song :)", "Info message",
							JOptionPane.PLAIN_MESSAGE);
					return;
				}
				for (Entry<String, Object> entry : media.getMetadata().entrySet()) {
					if (entry.getKey() == "album") {
						f1 = entry.getValue().toString();
						f1 = f1.replaceAll(" ", "+");
						f1 = f1.replaceAll("[^A-Za-z0-9()\\[\\]+]", "");
					} else if (entry.getKey() == "artist") {
						f2 = entry.getValue().toString();
						f2 = f2.replaceAll(" ", "+");
						f2 = f2.replaceAll("[^A-Za-z0-9()\\[\\]+]", "");
					} else if (entry.getKey() == "title") {
						f3 = entry.getValue().toString();
						f3 = f3.replaceAll(" ", "+");
						f3 = f3.replaceAll("[^A-Za-z0-9()\\[\\]+]", "");
					}
				}
				if (f1 != "")
					Desktop.getDesktop().browse(new URI("http://www.google.com/search?q=" + f1));
				else if (f2 != "")
					Desktop.getDesktop().browse(new URI("http://www.google.com/search?q=" + f2));
				else if (f3 != "")
					Desktop.getDesktop().browse(new URI("http://www.google.com/search?q=" + f3));
				else
					JOptionPane.showMessageDialog(null, "Unfortunately...no data for this song", "Info message",
							JOptionPane.PLAIN_MESSAGE);

			} catch (IOException | URISyntaxException e1) {
				e1.printStackTrace();
			}
		}
	});
	btnGoogleIt_1.setBounds(428, 76, 80, 23);
	panel.add(btnGoogleIt_1);

	Time_Left = new JLabel("");
	Time_Left.setBounds(367, 13, 53, 14);
	panel.add(Time_Left);

	Current_duration = new JLabel("");
	Current_duration.setBounds(10, 13, 46, 14);
	panel.add(Current_duration);

}