当前位置: 首页>>代码示例>>Java>>正文


Java JLabel.setBounds方法代码示例

本文整理汇总了Java中javax.swing.JLabel.setBounds方法的典型用法代码示例。如果您正苦于以下问题:Java JLabel.setBounds方法的具体用法?Java JLabel.setBounds怎么用?Java JLabel.setBounds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JLabel的用法示例。


在下文中一共展示了JLabel.setBounds方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: InformationFrame

import javax.swing.JLabel; //导入方法依赖的package包/类
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();
}
 
开发者ID:Coder-ACJHP,项目名称:Hotel-Properties-Management-System,代码行数:44,代码来源:InformationFrame.java

示例2: makeTitlePanel

import javax.swing.JLabel; //导入方法依赖的package包/类
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);
}
 
开发者ID:D4RK0V3RL0RD676,项目名称:apcs_final,代码行数:38,代码来源:MenuPanel.java

示例3: jbInit

import javax.swing.JLabel; //导入方法依赖的package包/类
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));
}
 
开发者ID:ser316asu,项目名称:SER316-Munich,代码行数:38,代码来源:AppFrame_AboutBox.java

示例4: makeTitleLabel

import javax.swing.JLabel; //导入方法依赖的package包/类
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);
}
 
开发者ID:D4RK0V3RL0RD676,项目名称:apcs_final,代码行数:10,代码来源:HelpPanel.java

示例5: Enemy

import javax.swing.JLabel; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:Uminks,项目名称:Star-Ride--RiverRaid,代码行数:19,代码来源:Enemy.java

示例6: createOuterDeadEnd

import javax.swing.JLabel; //导入方法依赖的package包/类
/**
 * 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);
	
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:44,代码来源:DynForm.java

示例7: createProcProbabilityPane

import javax.swing.JLabel; //导入方法依赖的package包/类
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;
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:35,代码来源:ProcGui.java

示例8: stampaMessaggioFineRound

import javax.swing.JLabel; //导入方法依赖的package包/类
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);
}
 
开发者ID:IngSW-unipv,项目名称:Progetto-A,代码行数:40,代码来源:PartitaOfflineGuiView.java

示例9: initialize

import javax.swing.JLabel; //导入方法依赖的package包/类
/**
* 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);

}
 
开发者ID:alexferreiradev,项目名称:3way_laboratorios,代码行数:59,代码来源:Inicial.java

示例10: HistoryViewer

import javax.swing.JLabel; //导入方法依赖的package包/类
/**
 * 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);


}
 
开发者ID:oussamabonnor1,项目名称:Java_event_Bank,代码行数:53,代码来源:HistoryViewer.java

示例11: initialize

import javax.swing.JLabel; //导入方法依赖的package包/类
/**
 * 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());
				}
			} 
		}
	});
}
 
开发者ID:matleses,项目名称:MD5,代码行数:79,代码来源:MD5.java

示例12: RemoveStudentDialog

import javax.swing.JLabel; //导入方法依赖的package包/类
/**
 * 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);
		}
	}
}
 
开发者ID:jtatia,项目名称:Course-Management-System,代码行数:70,代码来源:RemoveStudentDialog.java

示例13: DialogFrame

import javax.swing.JLabel; //导入方法依赖的package包/类
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();
}
 
开发者ID:Coder-ACJHP,项目名称:Hotel-Properties-Management-System,代码行数:54,代码来源:DialogFrame.java

示例14: Components

import javax.swing.JLabel; //导入方法依赖的package包/类
/**
 * 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));
	}
	
}
 
开发者ID:rehanjavedofficial,项目名称:Rush-Hour,代码行数:74,代码来源:MainFrame.java

示例15: WindowLoad

import javax.swing.JLabel; //导入方法依赖的package包/类
/**
 * 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();
	}
}
 
开发者ID:aben20807,项目名称:bridgechat,代码行数:55,代码来源:WindowLoad.java


注:本文中的javax.swing.JLabel.setBounds方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。