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

The following are Jave code examples for showing how to use setBounds() of the javax.swing.JLabel class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Hotel-Properties-Management-System   File: InformationFrame.java   View Source Code Vote up 6 votes
public InformationFrame() {
	
	setType(Type.POPUP);
	setResizable(false);
	
	setModalExclusionType(ModalExclusionType.APPLICATION_EXCLUDE);
	this.setTitle("Approving question");
	this.setPreferredSize(new Dimension(350, 170));
	this.setAlwaysOnTop(isAlwaysOnTopSupported());
	this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	getContentPane().setLayout(new BorderLayout());
	
	final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
	
	this.setLocation(screenSize.width / 2 - 150, screenSize.height / 2 - 75);
	
	this.setIconImage(Toolkit.getDefaultToolkit().getImage(InformationFrame.class.getResource(LOGOPATH)));
	
	final JPanel panel = new JPanel();
	getContentPane().add(panel, BorderLayout.CENTER);
	panel.setLayout(null);
	
	okBtn = new JButton("OK");
	okBtn.setIcon(new ImageIcon(InformationFrame.class.getResource("/com/coder/hms/icons/info_ok.png")));
	okBtn.setFont(new Font("Lucida Grande", Font.PLAIN, 15));
	okBtn.setBorder(new SoftBevelBorder(BevelBorder.RAISED, null, null, null, null));
	okBtn.setBounds(119, 102, 132, 35);
	okBtn.addActionListener(getAction());
	panel.add(okBtn);
	
	lblMessage = new JLabel("");
	lblMessage.setHorizontalTextPosition(SwingConstants.CENTER);
	lblMessage.setHorizontalAlignment(SwingConstants.LEFT);
	lblMessage.setBounds(87, 21, 246, 74);
	panel.add(lblMessage);
	
	lblIcon = new JLabel("");
	lblIcon.setIcon(new ImageIcon(InformationFrame.class.getResource("/com/coder/hms/icons/dialogPane_question.png")));
	lblIcon.setBounds(6, 36, 69, 70);
	panel.add(lblIcon);
	
	this.pack();
}
 
Example 2
Project: apcs_final   File: MenuPanel.java   View Source Code Vote up 5 votes
private void makeTitlePanel()
{
	int h = height/2-5;
	int w = 91*h/64;
	Font technoTitle = FileUtils.getFont(Font.BOLD, 48);
	Font technoSubtitle = FileUtils.getFont(Font.BOLD, 40);
	Color white = GameConstants.TEXT_COLOR;

	titlePanel = new JPanel(null);
	titlePanel.setBounds((width - w) / 2, 15, w, h);
	titlePanel.setOpaque(false);

	// Title Label
	JLabel titleLabel = new JLabel(title);
	titleLabel.setBounds(0, 30, w, 30);
	titleLabel.setHorizontalAlignment(SwingConstants.CENTER);
	titleLabel.setForeground(white);
	titleLabel.setFont(technoTitle);

	// Subtitle Label
	JLabel subtitleLabel = new JLabel(subtitle);
	subtitleLabel.setBounds(0, h-60, w, 30);
	subtitleLabel.setHorizontalAlignment(SwingConstants.CENTER);
	subtitleLabel.setForeground(white);
	subtitleLabel.setFont(technoSubtitle);

	// Youtube Image
	JLabel youtubeLabel = new JLabel();
	youtubeLabel.setBounds(0, 0, w, h);
	youtubeLabel.setHorizontalAlignment(SwingConstants.CENTER);
	youtubeLabel.setIcon(ImageUtils.getImageIcon("res/menu/youtube.png", w, h));

	titlePanel.add(titleLabel);
	titlePanel.add(subtitleLabel);
	titlePanel.add(youtubeLabel);
	add(titlePanel);
}
 
Example 3
Project: SER316-Munich   File: AppFrame_AboutBox.java   View Source Code Vote up 5 votes
private void jbInit() throws Exception  {    
  String text = "<html>";
  text += "<b>"+product+"</b><br><br>";
  text += copyright + "<br>" + url + "<br><br>";
  text += "<b>" + developersHead + "</b><br>";    
  for (int i = 0; i < developers.length; i++)
      text += developers[i]+"<br>";    
  text += "<br><b>" + othersHead + "</b><br>";    
  for (int i = 0; i < others.length; i++)
      text += others[i]+"<br>"; 
  
  text += "</html>";
  
  image = new ImageIcon(AppFrame_AboutBox.class.getResource("resources/memoranda.png"));
  this.setTitle(Local.getString("About Memoranda"));
  setResizable(false);
  // Initialize Objects
  lblText.setFont(new java.awt.Font("Dialog", 0, 11));
  lblText.setText(text);
  lblText.setBounds(10, 55, 300, 400);

  
  button1.setText(Local.getString("Ok"));
  button1.setBounds(150, 415, 95, 30);
  button1.addActionListener(this);
  button1.setPreferredSize(new Dimension(95, 30));
  button1.setBackground(new Color(69, 125, 186));
  button1.setForeground(Color.white);
  layeredPane = getLayeredPane();
  //layeredPane.setPreferredSize(new Dimension(300, 300));
  imgLabel = new JLabel(image);
  imgLabel.setBounds(0, 0, image.getIconWidth(), image.getIconHeight());
  layeredPane.add(imgLabel, new Integer(1));
  layeredPane.add(lblText, new Integer(2));    
  layeredPane.add(button1, new Integer(2));
  this.getContentPane().setBackground(new Color(251, 197, 63));
}
 
Example 4
Project: apcs_final   File: HelpPanel.java   View Source Code Vote up 5 votes
private void makeTitleLabel()
{
	titleLabel = new JLabel(title + ": " + subtitle);
	titleLabel.setBounds(0, 30, width, 60);
	titleLabel.setHorizontalAlignment(SwingConstants.CENTER);
	titleLabel.setForeground(GameConstants.TEXT_COLOR);
	titleLabel.setFont(FileUtils.getFont(Font.BOLD, 48));
	add(titleLabel);
}
 
Example 5
Project: Star-Ride--RiverRaid   File: Enemy.java   View Source Code Vote up 5 votes
/**
 * Constructor de la clase Enemy asigna valores iniciales de su aparición, asigna velocidad y recibe un ImageIcon que posteriormente transformara en Icon.
 * @param InitY Posicion Inicial Y
 * @param InitX Posicion Inicial X
 * @param Velocidad Velocidad de desplazamiento en Pixeles
 * @param image Imagen del Enemigo
 */
public Enemy(int InitX, int InitY, int Velocidad, ImageIcon image) {
    this.InitY = InitY;
    this.InitX = InitX;
    this.Velocidad = Velocidad;
    this.image = image;
    enemy = new JLabel();
    enemy.setBounds(InitX, InitY, 55, 55);
    icon = new ImageIcon(image.getImage().getScaledInstance(enemy.getWidth(), enemy.getHeight(), Image.SCALE_SMOOTH));
    enemy.setIcon(icon);
    noComprobar = false;
}
 
Example 6
Project: AgentWorkbench   File: DynForm.java   View Source Code Vote up 5 votes
/**
 * This method creates a so called dead end. This means that originally a class
 * should be displayed which was already displayed on a higher level in direction
 * to the root node. This was realized to prevent the form generation to be run
 * in an endless loop.
 *
 * @param oscsd the oscsd
 * @param className the class name
 * @param depth the depth
 * @param pan the pan
 * @param node the node
 */
private void createOuterDeadEnd(OntologySingleClassSlotDescription oscsd, String className, int depth, JPanel pan, DefaultMutableTreeNode node){
	
	// --- this outer element has no parents which are inner classes
	// --- so its added to the mainPanel
	final JPanel dataPanel = new JPanel();
	dataPanel.setLayout(null);
	dataPanel.setToolTipText(oscsd.getSlotName() + "-Panel");
	
	// --- add a JLabel to display the field's name
	JLabel valueFieldText = new JLabel();
	valueFieldText.setText("<html>" + oscsd.getSlotName() + " ["+oscsd.getSlotVarType()+"] - <b>" + Language.translate("Zyklisch !") + "</b></html>");
	valueFieldText.setBounds(new Rectangle(0, 4, 330, 16));
	
	// --- add both GUI elements to the panel
	dataPanel.add(valueFieldText, null);
	this.setPanelBounds(dataPanel);
	
	DynType dynType = new DynType(oscsd, DynType.typeCyclic, className, dataPanel, oscsd.getSlotName(), null);
	node.add(new DefaultMutableTreeNode(dynType));
	
	// --- set the new position (increment the height) for the parent panel of the 
	// --- newly created panel
	Rectangle pos = dataPanel.getBounds();
	pos.x = 10;//tiefe * einrueckungProUntereEbene;
	pos.y = pan.getHeight();
	dataPanel.setBounds(pos);

	pan.add(dataPanel);
	this.setPanelBounds(pan);
	
}
 
Example 7
Project: sstore-soft   File: ProcGui.java   View Source Code Vote up 5 votes
private JPanel createProcProbabilityPane(JPanel parent)
{
    m_paneProbability = new UpperPane(parent);
    m_paneProbability.setBorder(BorderFactory.createEtchedBorder());
    m_paneProbability.setLayout(null);

    String sToolTips = "Probability this procedure is executed";

    m_txtProbability.setText(Integer.toString(0));
    int nWidthTxt = (int) ((double) m_paneProbability.getWidth() * 0.07);
    m_txtProbability.setSize(nWidthTxt, m_paneProbability.getHeight());
    m_txtProbability.setEditable(false);
    m_txtProbability.setToolTipText(sToolTips);
    m_paneProbability.add(m_txtProbability);

    JLabel lblPercent = new JLabel("%");
    int nWidthLbl = (int) ((double) nWidthTxt * 0.3);
    lblPercent.setBounds(nWidthTxt, 0, nWidthLbl, m_paneProbability.getHeight());
    m_paneProbability.add(lblPercent);

    m_slideProbability.setMajorTickSpacing(10);
    m_slideProbability.setMinorTickSpacing(1);
    m_slideProbability.setPaintLabels(true);
    m_slideProbability.setPaintTicks(true);
    m_slideProbability.setSnapToTicks(true);
    int nXStart = nWidthTxt + nWidthLbl + GuiConstants.GAP_COMPONENT;
    m_slideProbability.setBounds(nXStart, 0, m_paneProbability.getWidth() - nXStart, m_paneProbability.getHeight());
    m_slideProbability.setToolTipText(sToolTips);
    m_paneProbability.add(m_slideProbability);

    disableProcOptions();

    return m_paneProbability;
}
 
Example 8
Project: Progetto-A   File: PartitaOfflineGuiView.java   View Source Code Vote up 5 votes
private void stampaMessaggioFineRound(Giocatore giocatore) {
    Giocatore mazziere = model.getMazziere();
    String msg = "";
    
    if(!giocatore.isMazziere()) {
        if(mazziere.getStatoMano() == StatoMano.Sballato) {
            if(giocatore.getStatoMano() == StatoMano.Sballato)
                msg = giocatore.getNome() + " paga " + giocatore.getPuntata() + " al mazziere";
            else if ((giocatore.getStatoMano() == StatoMano.OK) || (giocatore.getStatoMano() == StatoMano.SetteeMezzo))
                msg = giocatore.getNome() + " riceve " + giocatore.getPuntata() + " dal mazziere";
            else if(giocatore.getStatoMano() == StatoMano.SetteeMezzoReale)
                msg = giocatore.getNome() + " riceve " + 2*giocatore.getPuntata() + " dal mazziere";
        } else {
            if((giocatore.getStatoMano() == StatoMano.Sballato) || (giocatore.getValoreMano() <= mazziere.getValoreMano()))
                msg = giocatore.getNome() + " paga " + giocatore.getPuntata() + " al mazziere";
            else if (giocatore.getValoreMano() > mazziere.getValoreMano())
                msg = giocatore.getNome() + " riceve " + giocatore.getPuntata() + " dal mazziere";
            else if ((giocatore.getStatoMano() == StatoMano.SetteeMezzoReale) && (giocatore.getValoreMano() > mazziere.getValoreMano()))
                msg = giocatore.getNome() + " riceve " + 2*giocatore.getPuntata() + " dal mazziere";
            else if(mazziere.getStatoMano() == StatoMano.SetteeMezzoReale)
                msg = giocatore.getNome() + " paga " + 2*giocatore.getPuntata() + " al mazziere";
        }
    } else
        msg = "Il mazziere regola i suoi conti";
    
    Font font = new Font("MsgFineRound", Font.BOLD, 70);
    JLabel msgFineRound = new JLabel(msg);
    msgFineRound.setFont(font);
    msgFineRound.setForeground(Color.black);
    int strWidth = msgFineRound.getFontMetrics(font).stringWidth(msg);
    msgFineRound.setBounds(this.getWidth()/2 - strWidth/2, this.getHeight()/2 - 60, strWidth, 90);
    
    sfondo.add(msgFineRound);
    sfondo.repaint();
    
    pausa(pausa_lunga);
    
    sfondo.remove(msgFineRound);
}
 
Example 9
Project: 3way_laboratorios   File: Inicial.java   View Source Code Vote up 4 votes
/**
* Método responsável por inicializar todos os componentes swing deste frame
*
*/
private void initialize() {				
	frmGereciamentoDeBanco = new JFrame();
	frmGereciamentoDeBanco.setResizable(false);
	frmGereciamentoDeBanco.setTitle("Sistema de Gereciamento de Banco");
	frmGereciamentoDeBanco.setBounds(100, 100, 800, 600);
	frmGereciamentoDeBanco.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	frmGereciamentoDeBanco.getContentPane().setLayout(null);
	frmGereciamentoDeBanco.setLocationRelativeTo(null);

	JLabel lblBanco = new JLabel("Banco:");
	lblBanco.setFont(new Font("Tahoma", Font.BOLD, 14));
	lblBanco.setBounds(10, 11, 74, 23);
	frmGereciamentoDeBanco.getContentPane().add(lblBanco);

	JLabel lblAgencia = new JLabel("Agência:");
	lblAgencia.setFont(new Font("Tahoma", Font.BOLD, 14));
	lblAgencia.setBounds(10, 45, 74, 23);
	frmGereciamentoDeBanco.getContentPane().add(lblAgencia);

	btnManterClientes = new JButton("Manter Clientes");
	btnManterClientes.setBounds(10, 89, 170, 37);
	frmGereciamentoDeBanco.getContentPane().add(btnManterClientes);

	btnOperaesBancarias = new JButton("Operações Bancarias");
	btnOperaesBancarias.setBounds(190, 89, 170, 37);
	btnOperaesBancarias.setEnabled(Boolean.FALSE);
	frmGereciamentoDeBanco.getContentPane().add(btnOperaesBancarias);

	lblBancoResult = new JLabel("...");
	lblBancoResult.setFont(new Font("Tahoma", Font.BOLD, 14));
	lblBancoResult.setBounds(94, 11, 480, 20);
	frmGereciamentoDeBanco.getContentPane().add(lblBancoResult);

	lblAgenciaResult = new JLabel("...");
	lblAgenciaResult.setFont(new Font("Tahoma", Font.BOLD, 14));
	lblAgenciaResult.setBounds(94, 45, 480, 20);
	frmGereciamentoDeBanco.getContentPane().add(lblAgenciaResult);

	JSeparator separator = new JSeparator();
	separator.setBounds(10, 79, 764, 11);
	frmGereciamentoDeBanco.getContentPane().add(separator);

	panelInterno = new JDesktopPane();
	panelInterno.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0)));
	panelInterno.setBounds(10, 137, 764, 414);
	frmGereciamentoDeBanco.getContentPane().add(panelInterno);
	panelInterno.setLayout(null);

	frameInterno = new JInternalFrame("New JInternalFrame");
	frameInterno.setBounds(10, 11, 744, 392);
	panelInterno.add(frameInterno);
	frameInterno.setVisible(false);

}
 
Example 10
Project: Java_event_Bank   File: HistoryViewer.java   View Source Code Vote up 4 votes
/**
 * Create the frame.
 */
public HistoryViewer(String[] transactions) {
    this.transactions = transactions;

    int screenPositionX = (int) Toolkit.getDefaultToolkit().getScreenSize().getWidth() / 2 - 210;
    int screenPositionY = (int) Toolkit.getDefaultToolkit().getScreenSize().getHeight() / 2 - 290;
    setTitle("Bank Simulator");
    setResizable(false);
    setSize(419, 584);
    setLocation(screenPositionX, screenPositionY);
    setDefaultCloseOperation(HIDE_ON_CLOSE);

    JPanel panel = new JPanel();
    panel.setBackground(new Color(255, 255, 255));
    getContentPane().add(panel, BorderLayout.CENTER);
    panel.setLayout(null);

    JLabel lblBankSimulator = new JLabel("Bank Simulator");
    lblBankSimulator.setHorizontalAlignment(SwingConstants.CENTER);
    lblBankSimulator.setFont(new Font("Century Gothic", Font.BOLD, 36));
    lblBankSimulator.setForeground(new Color(0, 204, 153));
    lblBankSimulator.setBounds(79, 56, 265, 51);
    panel.add(lblBankSimulator);

    JLabel lblUsername = new JLabel("Reacent Transactions");
    lblUsername.setHorizontalAlignment(SwingConstants.CENTER);
    lblUsername.setForeground(new Color(0, 204, 153));
    lblUsername.setFont(new Font("Century Gothic", Font.BOLD, 21));
    lblUsername.setBounds(79, 133, 265, 45);
    panel.add(lblUsername);

    JList list = new JList();
    list.setFont(new Font("Tahoma", Font.BOLD, 13));
    list.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 204, 102)));
    list.setModel(new AbstractListModel() {

        public int getSize() {
            return transactions.length;
        }

        public Object getElementAt(int index) {
            return transactions[index];
        }
    });
    list.setForeground(new Color(0, 204, 102));
    list.setBounds(79, 214, 265, 279);
    panel.add(list);


}
 
Example 11
Project: MD5   File: MD5.java   View Source Code Vote up 4 votes
/**
 * Initialize the contents of the frame.
 */
private void initialize() {
	frame = new JFrame();
	frame.setTitle("MD5");
	frame.setResizable(false);
	frame.setBounds(100, 100, 450, 580);
	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	frame.getContentPane().setLayout(null);

	JLabel label = new JLabel("Please select your files:");
	label.setBounds(105, 32, 227, 16);
	frame.getContentPane().add(label);

	final JLabel error = new JLabel("");
	error.setForeground(new Color(255,0,0));
	error.setBounds(120, 52, 250, 16);
	frame.getContentPane().add(error);

	final JFileChooser filesChooser = new JFileChooser();
	filesChooser.setControlButtonsAreShown(false);
	filesChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
	filesChooser.setMultiSelectionEnabled(true);
	filesChooser.setBounds(41, 62, 362, 400);
	frame.getContentPane().add(filesChooser);

	JButton btnStartMD5 = new JButton("Start MD5");
	btnStartMD5.setBounds(132, 490, 177, 29);
	frame.getContentPane().add(btnStartMD5);

	//listener to run the application launch when the button is pressed
	btnStartMD5.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent e)  {
			// It recovers the files selected
			File[] files;
			try{
				files = filesChooser.getSelectedFiles();
			}catch(NullPointerException exc){
				error.setText("No selected file");
				throw new Md5Exception("No selected file : " + exc.getMessage());
			}
			for(int i = 0; i < files.length; i++){
				String fileName = files[i].getAbsolutePath()  ;
				//Creation du md5 en java
				String output;
				try{
					output = CreateMD5.getMD5(fileName);
				}catch(Md5Exception e1){
					error.setText("Error creating the MD5");
					throw new Md5Exception("Error creating the MD5 : " + e1.getMessage());
				}
				/*Writing the md5 file
				  remove the extension of the original file if there is*/
				String path;
				if(files[i].getAbsolutePath().lastIndexOf(".") == -1){
					path = files[i].getAbsolutePath() + ".md5";
				}else {
					String nomFichierSansExt = files[i].getAbsolutePath().substring(0, files[i].getAbsolutePath().lastIndexOf(".")) ;
					path = nomFichierSansExt + ".md5";
				}	
				File file = new File(path); 
				try {
					if (!file.exists()){
						// File Creation
						file.createNewFile();
					}
					FileWriter writer = new FileWriter(file, true);
					writer.write(output);
					writer.close();
				} catch (Exception ex) {
					error.setText("Impossible to create MD5");
					throw new Md5Exception("Impossible to create MD5 : " + ex.getMessage());
				}
			} 
		}
	});
}
 
Example 12
Project: Course-Management-System   File: RemoveStudentDialog.java   View Source Code Vote up 4 votes
/**
 * Create the dialog.
 */
public RemoveStudentDialog() {
	setVisible(true);
	setTitle("Remove Student");
	setBounds(100, 100, 450, 300);
	getContentPane().setLayout(new BorderLayout());
	contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
	getContentPane().add(contentPanel, BorderLayout.CENTER);
	contentPanel.setLayout(null);
	
	JLabel lblEnterTheRoll = new JLabel("Enter the Roll Number of the student to be removed :");
	lblEnterTheRoll.setBounds(21, 66, 360, 14);
	contentPanel.add(lblEnterTheRoll);
	
	textField = new JTextField();
	textField.setBounds(21, 93, 297, 20);
	contentPanel.add(textField);
	textField.setColumns(10);
	{
		JPanel buttonPane = new JPanel();
		buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
		getContentPane().add(buttonPane, BorderLayout.SOUTH);
		{
			JButton okButton = new JButton("Submit");
			okButton.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent arg0) {
				try
				{
					// obtaining the roll number of the student to be removed
					String rollno=textField.getText();
					StudentDAO dao=new StudentDAO();
					Student stud=dao.getStudentByRollno(rollno);
					// checking if the roll number is a valid roll number that is whether it exists in the database or not
					if(stud!=null)
					{
						StudentDbHandler sdbh=new StudentDbHandler();
						sdbh.removeStudent(rollno);
						// calling the method of the StudentDbHandler to remove the student using the roll number
						JOptionPane.showMessageDialog(RemoveStudentDialog.this,"Successfully removed the student from the database","Info : ",JOptionPane.INFORMATION_MESSAGE);
						// on removal of the student display suitable message of success in removing the student
						// hide the dialog box and dispose it when the student has been successfully removed 
						RemoveStudentDialog.this.setVisible(false);
						RemoveStudentDialog.this.dispose();
					}	
					else
					{
						JOptionPane.showMessageDialog(RemoveStudentDialog.this,"No such Rollno exists in the database","Alert : ",JOptionPane.WARNING_MESSAGE);
					}	
				}
				catch(Exception e)
				{
					e.printStackTrace();
					JOptionPane.showMessageDialog(RemoveStudentDialog.this,e.getMessage(),"Error : ",JOptionPane.ERROR_MESSAGE);
				}
				}
			});
			okButton.setActionCommand("OK");
			buttonPane.add(okButton);
			getRootPane().setDefaultButton(okButton);
		}
		{
			JButton cancelButton = new JButton("Cancel");
			cancelButton.setActionCommand("Cancel");
			buttonPane.add(cancelButton);
		}
	}
}
 
Example 13
Project: Hotel-Properties-Management-System   File: DialogFrame.java   View Source Code Vote up 4 votes
public DialogFrame() {
	
	setType(Type.POPUP);
	setResizable(false);
	
	setModalExclusionType(ModalExclusionType.APPLICATION_EXCLUDE);
	this.setTitle("Approving question");
	this.setPreferredSize(new Dimension(400, 190));
	this.setAlwaysOnTop(isAlwaysOnTopSupported());
	this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	getContentPane().setLayout(new BorderLayout());
	
	final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
	
	this.setLocation(screenSize.width / 2 - 150, screenSize.height / 2 - 75);
	
	this.setIconImage(Toolkit.getDefaultToolkit().
			getImage(getClass().getResource(LOGOPATH)));
	
	final JPanel panel = new JPanel();
	panel.setAutoscrolls(true);
	getContentPane().add(panel, BorderLayout.CENTER);
	panel.setLayout(null);
	
	btnYes = new JButton("YES");
	btnYes.setBorder(new SoftBevelBorder(BevelBorder.RAISED, null, null, null, null));
	btnYes.setBounds(291, 129, 91, 29);
	panel.add(btnYes);
	
	btnNo = new JButton("NO");
	btnNo.setBorder(new SoftBevelBorder(BevelBorder.RAISED, null, null, null, null));
	btnNo.setBounds(199, 129, 91, 29);
	panel.add(btnNo);
	
	lblIcon = new JLabel("");
	lblIcon.setIcon(new ImageIcon(DialogFrame.class.getResource("/com/coder/hms/icons/dialogPane_question.png")));
	lblIcon.setBounds(14, 40, 69, 70);
	panel.add(lblIcon);
	
	
	textArea = new JTextArea();
	textArea.setDisabledTextColor(new Color(153, 204, 255));
	textArea.setBounds(95, 32, 287, 85);
	textArea.setBackground(UIManager.getColor("ComboBox.background"));
	textArea.setBorder(null);
	textArea.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
	textArea.setEditable(false);
	textArea.setFont(new Font("Monospaced", Font.PLAIN, 14));
	textArea.setLineWrap(true);
	panel.add(textArea);
	
	this.pack();
}
 
Example 14
Project: Rush-Hour   File: MainFrame.java   View Source Code Vote up 4 votes
/**
 * Initializing the components.
 */
private void Components() {
	
	letsPlay = new JLabel("Let's Play");
	letsPlay.setHorizontalAlignment(SwingConstants.CENTER);
	letsPlay.setBounds(6, 6, 644, 16);
	contentPane.add(letsPlay);
	
	vLabel = new JLabel("Vehicle:");
	vLabel.setBounds(6, 47, 61, 16);
	contentPane.add(vLabel);
	
	vehicle = new JComboBox<>();
	vehicle.setBounds(79, 43, 83, 27);
	contentPane.add(vehicle);
	
	rLabel = new JLabel("Row:");
	rLabel.setBounds(174, 47, 44, 16);
	contentPane.add(rLabel);
	
	row = new JComboBox<>();
	row.setBounds(230, 43, 83, 27);
	contentPane.add(row);
	
	colsLabel = new JLabel("Column:");
	colsLabel.setBounds(335, 47, 61, 16);
	contentPane.add(colsLabel);
	
	column = new JComboBox<>();
	column.setBounds(408, 43, 83, 27);
	contentPane.add(column);
	
	execute = new JButton("Execute");
	execute.setForeground(Color.BLACK);
	execute.setBackground(Color.WHITE);
	execute.setBounds(503, 42, 117, 29);
	contentPane.add(execute);
	
	lblThisRowAnd = new JLabel("This row and column represents the head of vehicle");
	lblThisRowAnd.setFont(new Font("Lucida Grande", Font.PLAIN, 9));
	lblThisRowAnd.setBounds(200, 26, 252, 16);
	contentPane.add(lblThisRowAnd);
	
	int x = 174, y = 97;
	for(int i = 0; i < cells.length; i++){
	
		for(int j = 0; j < cells[i].length; j++){
			
			cells[i][j] = new JLabel("");
			cells[i][j].setOpaque(true);
			cells[i][j].setForeground(Color.white);
			cells[i][j].setHorizontalAlignment(SwingConstants.CENTER);
			cells[i][j].setBackground(new Color(204, 204, 204));
			cells[i][j].setBounds(x+(j*50), y, 50, 50);
			x += 1;
			contentPane.add(cells[i][j]);
		}
		x = 174;
		y += 51;
	}
	
	cells[2][5].setText("Exit");
	cells[2][5].setBackground(Color.red);
	
	for(int i = 1; i <= 6; i++){
		vehicle.addItem(String.valueOf(i));
		row.addItem(String.valueOf(i));
		column.addItem(String.valueOf(i));
	}
	
}
 
Example 15
Project: bridgechat   File: WindowLoad.java   View Source Code Vote up 4 votes
/**
 * Create the frame.
 * 
 * @throws MalformedURLException
 */
public WindowLoad() throws MalformedURLException {

	// can't resize the window
	setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	setResizable(false);

	setIconImage(Toolkit.getDefaultToolkit().getImage(WindowLoad.class.getResource("/resource/chip.png")));
	setTitle("Bridge Chat");
	setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	setBounds(100, 100, 331, 422);
	contentPane = new JPanel();
	contentPane.setBackground(new Color(204, 204, 255));
	contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
	setContentPane(contentPane);
	contentPane.setLayout(null);

	try {

		// URL url = new
		// URL("https://media.giphy.com/media/sSgvbe1m3n93G/giphy.gif");
		// ImageIcon icon = new ImageIcon(url);
		// ImageIcon icon = new ImageIcon("resource/ellipsis.gif","test");
		// label1 = new JLabel("Image and Text", icon, JLabel.CENTER);
		ClassLoader cldr = this.getClass().getClassLoader(); // set my
																// resource
		java.net.URL imageURL = cldr.getResource("resource/ellipsis.gif");
		ImageIcon icon2 = new ImageIcon(imageURL);
		JLabel labelGifLoading = new JLabel(icon2);
		labelGifLoading.setBounds(152, 22, 145, 15);
		contentPane.add(labelGifLoading);

		JLabel labelTextLoading = new JLabel("L o a d i n g ");
		labelTextLoading.setFont(new Font("AR ESSENCE", Font.PLAIN, 18));
		labelTextLoading.setBounds(32, 14, 106, 23);
		contentPane.add(labelTextLoading);

		ClassLoader cldr2 = this.getClass().getClassLoader(); // set my
																// resource
		java.net.URL imageURL2 = cldr2.getResource("resource/loading.gif");
		ImageIcon icon = new ImageIcon(imageURL2);
		// ImageIcon icon = new ImageIcon(new
		// URL("https://i.giphy.com/3o8doNAGKZXsrsgzW8.gif"));
		JLabel labelGifBg = new JLabel(icon);
		labelGifBg.setBounds(0, 0, 335, 393);
		contentPane.add(labelGifBg);
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
Example 16
Project: Library-app   File: NuevoPrestamo.java   View Source Code Vote up 4 votes
private void initComponents() {
	
	setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
	setBounds(100, 100, 439, 337);
	contentPane = new JPanel();
	contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
	setContentPane(contentPane);
	contentPane.setLayout(null);
	
	txtUsuario = new JTextField();
	txtUsuario.setFont(new Font("Tahoma", Font.BOLD, 11));
	txtUsuario.setEditable(false);
	txtUsuario.setBounds(16, 36, 314, 23);
	contentPane.add(txtUsuario);
	txtUsuario.setColumns(10);
	
	JLabel lblUsuario = new JLabel("Usuario");
	lblUsuario.setBounds(16, 21, 61, 14);
	contentPane.add(lblUsuario);
	
	txtCodigo = new JTextField();
	txtCodigo.setFont(new Font("Tahoma", Font.BOLD, 11));
	txtCodigo.setEditable(false);
	txtCodigo.setBounds(16, 146, 314, 23);
	contentPane.add(txtCodigo);
	txtCodigo.setColumns(10);
	
	lblCodigo = new JLabel("Codigo ");
	lblCodigo.setBounds(16, 128, 126, 14);
	contentPane.add(lblCodigo);	
	
	lblfecha_prestDePrestamo = new JLabel("Fecha de pr\u00E9stamo");
	lblfecha_prestDePrestamo.setBounds(16, 193, 148, 14);
	contentPane.add(lblfecha_prestDePrestamo);
	
	btnBuscarCodigo = new JButton("...");
	btnBuscarCodigo.setBounds(346, 146, 61, 23);
	contentPane.add(btnBuscarCodigo);
	btnBuscarCodigo.setEnabled(false);
	btnBuscarCodigo.addActionListener(this);
	
	btnBuscarUsuario = new JButton("...");
	btnBuscarUsuario.setBounds(346, 35, 61, 23);
	contentPane.add(btnBuscarUsuario);
	btnBuscarUsuario.addActionListener(this);
	
	tipo = new Choice();
	tipo.setBounds(16, 91, 115, 20);
	tipo.add("Seleccione");
	tipo.add("Libro");
	tipo.add("Revista");
	tipo.add("CDROM");
	tipo.add("Articulo");
	tipo.setEnabled(false);
	tipo.addItemListener(this);
	contentPane.add(tipo);
	
	lblTipo = new JLabel("Tipo");
	lblTipo.setBounds(16, 71, 46, 14);
	contentPane.add(lblTipo);
	
	addWindowListener(this);
	setVisible(true);
	setLocationRelativeTo(null);
}
 
Example 17
Project: KernelHive   File: LoginDialog.java   View Source Code Vote up 4 votes
public LoginDialog() {
	getContentPane().setLayout(null);

	final JLabel lblUsername = new JLabel("Username");
	lblUsername.setBounds(12, 12, 86, 15);
	getContentPane().add(lblUsername);

	final JLabel lblPassword = new JLabel("Password");
	lblPassword.setBounds(12, 39, 86, 15);
	getContentPane().add(lblPassword);

	textField = new JTextField();
	textField.setBounds(116, 10, 114, 19);
	getContentPane().add(textField);
	textField.setColumns(10);

	passwordField = new JPasswordField();
	passwordField.setBounds(116, 37, 114, 19);
	getContentPane().add(passwordField);

	lblValidationError = new JLabel("Invalid username or password!");
	lblValidationError
			.setIcon(new ImageIcon(
					NewProjectDialog.class
							.getResource("/com/sun/java/swing/plaf/windows/icons/Error.gif")));
	lblValidationError.setBounds(12, 66, 424, 32);
	getContentPane().add(lblValidationError);

	btnLogin = new JButton("Login");
	btnLogin.setBounds(319, 230, 117, 25);
	btnLogin.addActionListener(new ActionListener() {

		@Override
		public void actionPerformed(final ActionEvent e) {
			// TODO

		}
	});
	getContentPane().add(btnLogin);

	progressBar = new JProgressBar();
	progressBar.setBounds(12, 110, 424, 14);
	getContentPane().add(progressBar);
}
 
Example 18
Project: password-manager   File: PasswordManagerRegistration.java   View Source Code Vote up 4 votes
public PasswordManagerRegistration(PasswordManagerGUI gui) {
       this.gui = gui;
	regpanel = new JPanel();
	regpanel.setLayout(new BorderLayout(0, 0));
	JPanel panel_1 = new JPanel();
	regpanel.add(panel_1, BorderLayout.NORTH);

	JLabel lblRegistration = new JLabel(Labels.REG_REGISTRATION);
	lblRegistration.setFont(new Font("Tahoma", Font.PLAIN, 38));
	panel_1.add(lblRegistration);

	JPanel panel_2 = new JPanel();
	regpanel.add(panel_2, BorderLayout.CENTER);
	panel_2.setLayout(null);

	JLabel lblUsername = new JLabel(Labels.REG_USERNAME);
	lblUsername.setBounds(74, 92, 132, 16);
	panel_2.add(lblUsername);
	
	JLabel lblPassword = new JLabel(Labels.REG_PASSWORD);
	lblPassword.setBounds(74, 149, 173, 16);
	panel_2.add(lblPassword);
	
	JLabel lblPasswordAgain = new JLabel(Labels.REG_RE_PASSWORD);
	lblPasswordAgain.setBounds(74, 204, 173, 16);
	panel_2.add(lblPasswordAgain);
	
	txtUsername = new JTextField();
	txtUsername.setBounds(252, 89, 380, 22);
	panel_2.add(txtUsername);
	txtUsername.setColumns(10);
	
	txtPass1 = new JPasswordField();
	txtPass1.setBounds(252, 146, 380, 22);
	panel_2.add(txtPass1);
	
	txtPass2 = new JPasswordField();
	txtPass2.setBounds(252, 201, 380, 22);
	txtPass1.addActionListener(gui.getController());
	txtPass1.setActionCommand(Labels.REG_PASS1FIELD);
	txtPass2.addActionListener(gui.getController());
       txtPass2.setActionCommand(Labels.REG_PASS2FIELD);
	txtUsername.addActionListener(gui.getController());
       txtUsername.setActionCommand(Labels.REG_USERFIELD);
	panel_2.add(txtPass2);
	
	JButton btnRegistration = new JButton(Labels.REG_REGBUTTON);
	btnRegistration.addActionListener(gui.getController());

	btnRegistration.setBounds(278, 288, 151, 25);
	panel_2.add(btnRegistration);

}
 
Example 19
Project: Star-Ride--RiverRaid   File: Creditos.java   View Source Code Vote up 3 votes
public void initComponents(){
    
    volverMenu = new JLabel();
    volverMenu.setBounds(650, 400, 100, 100);
    volverMenu.setIcon(AsignLabelDimension(new ImageIcon(pathBaseLabel+"Flecha-1.png"), volverMenu));
    volverMenu.addMouseListener(new MouseEvents());
    
    
}
 
Example 20
Project: VisualGraphviz   File: MainFrame.java   View Source Code Vote up 2 votes
private void addPaintButton() {
    /* paint button */
    paint = new JButton("paint");
    paint.setBounds(760, 10, 80, 30);
    paint.setFont(buttonFont);
    paint.setMargin(DEFAULT_INSETS);

    /* image */
    imageLabel = new JLabel();
    imageLabel.setBounds(0, 0, 520, 680);

    paint.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            isPainted = false;
        }
    });
}