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


Java JPanel.setBounds方法代码示例

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


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

示例1: initialize

import javax.swing.JPanel; //导入方法依赖的package包/类
/**
 * Initialize the contents of the frame.
 */
public void initialize(){
	JPanel panel_7 = new JPanel();
	panel_7.setBounds(0, 0, 665, 415);
	frmPiattaformaGaming.getContentPane().add(panel_7);
	panel_7.setLayout(new MigLayout());
	panel_7.setVisible(true);
	
	JTextArea ta = new JTextArea();
	ta.setEditable(false);
	panel_7.add(ta);
	
	ArrayList<Recensione> al = new GiocoController(gioco).allReviews();
	for( Recensione r : al ){
		ta.setText(ta.getText() + "  - " +  r.getTesto() + "\n\n");
	}
	
	JButton btnBack = new JButton("Indietro");
	panel_7.add(btnBack, "pos 267px 345px, width 110, height 15");
	
	JScrollPane scroll = new JScrollPane(ta);
	scroll.setVerticalScrollBarPolicy ( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS );
	scroll.getVerticalScrollBar().setUnitIncrement(20);
	scroll.setSize(460,240);
	panel_7.add(scroll, "pos 0px 0px, width 660, height 340");
	
	btnBack.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent e) {
			panel_7.setVisible(false);
			new GiocoView(frmPiattaformaGaming, utente, gioco);
	}});
}
 
开发者ID:StefanoMartella,项目名称:GamingPlatform,代码行数:35,代码来源:GiocoRecensioniView.java

示例2: setPanelBounds

import javax.swing.JPanel; //导入方法依赖的package包/类
/**
 * Sets the bounds of the given panel, depending on the child components on this panel.
 *
 * @param panel the new panel bounds
 */
private void setPanelBounds(JPanel panel){
	
	int xPos = panel.getX();
	int yPos = panel.getY();
	int maxX = 0;
	int maxY = 0;
	
	Component[] components = panel.getComponents();
	for (int i = 0; i < components.length; i++) {
		int currXMax = components[i].getX() + components[i].getWidth();
		int currYMax = components[i].getY() + components[i].getHeight();
		if (currXMax > maxX) maxX = currXMax;
		if (currYMax > maxY) maxY = currYMax;
	}
	
	maxX += 5;
	maxY += 2;
	panel.setBounds(xPos, yPos, maxX, maxY);

}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:26,代码来源:DynForm.java

示例3: addTableViewEditPane

import javax.swing.JPanel; //导入方法依赖的package包/类
private void addTableViewEditPane()
{
    JPanel paneTableDisplayAndEdit = new JPanel();
    paneTableDisplayAndEdit.setLayout(null);
    int nWidth = m_paneParent.getWidth();
    int nHeight = m_paneParent.getHeight() - m_paneTblBt.getHeight() - 3 * GuiConstants.GAP_COMPONENT;
    paneTableDisplayAndEdit.setBounds(0, m_paneTblBt.getHeight(), nWidth, nHeight);
    add(paneTableDisplayAndEdit);
    // paneTableDisplayAndEdit.setBorder(BorderFactory.createLineBorder(Color.red));

    m_scrollTblName = new LHSListPane(paneTableDisplayAndEdit, m_lstTblName);
    paneTableDisplayAndEdit.add(m_scrollTblName);
    paneTableDisplayAndEdit.add(createTableCSVArea());
    paneTableDisplayAndEdit.add(createTableCardinalityArea());
    paneTableDisplayAndEdit.add(createColumnViewArea());
    paneTableDisplayAndEdit.add(createColumnEditArea());
    disableTableOptions();
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:19,代码来源:TableGui.java

示例4: createTableCSVArea

import javax.swing.JPanel; //导入方法依赖的package包/类
private JPanel createTableCSVArea()
{
    JPanel paneCSV = new JPanel();
    paneCSV.setLayout(new BoxLayout(paneCSV, BoxLayout.X_AXIS));
    paneCSV.setBorder(BorderFactory.createLineBorder(Color.GRAY));

    paneCSV.add(m_checkLinkCsv);
    paneCSV.add(m_txtLinkCsvPath);
    m_txtLinkCsvPath.setEditable(false);

    paneCSV.setBounds(m_scrollTblName.getWidth() + GuiConstants.GAP_COMPONENT, m_nYOffsetInRightPane,
                      s_nRightPaneWidth, s_nOneRowPaneHeight);
    m_nYOffsetInRightPane += (s_nOneRowPaneHeight + GuiConstants.GAP_COMPONENT);

    return paneCSV;
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:17,代码来源:TableGui.java

示例5: update

import javax.swing.JPanel; //导入方法依赖的package包/类
/**
 * Updates this {@code InfoPanel}.
 *
 * @param mapTransform The current MapTransform.
 */
public void update(MapTransform mapTransform) {
    final JPanel p = (mapTransform == null) ? null
        : mapTransform.getDescriptionPanel();
    if (p != null) {
        p.setOpaque(false);
        final Dimension d = p.getPreferredSize();
        p.setBounds(0, (this.mapEditorPanel.getHeight() - d.height)/2,
            this.mapEditorPanel.getWidth(), d.height);
        this.mapEditorPanel.removeAll();
        this.mapEditorPanel.add(p, BorderLayout.CENTER);
        this.mapEditorPanel.validate();
        this.mapEditorPanel.revalidate();
    }
    update();
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:21,代码来源:InfoPanel.java

示例6: createProcParasPane

import javax.swing.JPanel; //导入方法依赖的package包/类
private JPanel createProcParasPane(JPanel parent)
{
    JPanel paneProcParas = new JPanel();
    paneProcParas.setLayout(null);
    paneProcParas.setBorder(BorderFactory.createEtchedBorder());
    int nYStartPaneProcParas = m_paneProbability.getHeight() + GuiConstants.GAP_COMPONENT;
    paneProcParas.setBounds(0, nYStartPaneProcParas, parent.getWidth(), parent.getHeight() - nYStartPaneProcParas);

    LHSListPane scrollParaNames = new LHSListPane(paneProcParas, m_lstProcParaNames);
    paneProcParas.add(scrollParaNames);

    paneProcParas.add(m_paneParaDistribution);
    int nXStartParaDistribution = scrollParaNames.getWidth() + GuiConstants.GAP_COMPONENT;
    int nWidthParaDistribution = paneProcParas.getWidth() - nXStartParaDistribution - GuiConstants.GAP_COMPONENT;
    int nHeightParaDistribution = scrollParaNames.getHeight() - 2 * GuiConstants.GAP_COMPONENT;
    m_paneParaDistribution.setBounds(nXStartParaDistribution, GuiConstants.GAP_COMPONENT, nWidthParaDistribution,
                                     nHeightParaDistribution);

    m_paneParaDistribution.add(s_paneDummy);

    return paneProcParas;
}
 
开发者ID:s-store,项目名称:s-store,代码行数:23,代码来源:ProcGui.java

示例7: drawTrack

import javax.swing.JPanel; //导入方法依赖的package包/类
public void drawTrack(){
	int trackRectWidth 	= 12;
	int trackRectHeight = panelTrackView.getHeight();
	Border thickBorder = new LineBorder(Color.WHITE, 2);

	JPanel trackRect = new JPanel();
	trackRect.setOpaque(false);
	trackRect.setBorder(thickBorder);
	trackRect.setBounds(50, -4, trackRectWidth, trackRectHeight + 4);
	panelTrackView.add(trackRect);
}
 
开发者ID:kevingilboy,项目名称:COE1186,代码行数:12,代码来源:TrackModelGUI.java

示例8: createOuterDeadEnd

import javax.swing.JPanel; //导入方法依赖的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

示例9: addProcedureViewEditPane

import javax.swing.JPanel; //导入方法依赖的package包/类
private void addProcedureViewEditPane()
{
    JPanel paneSp = new JPanel();
    paneSp.setLayout(null);
    int nWidth = m_paneParent.getWidth();
    int nHeight = m_paneParent.getHeight() - m_paneButtons.getHeight() - 3 * GuiConstants.GAP_COMPONENT;
    paneSp.setBounds(0, m_paneButtons.getHeight(), nWidth, nHeight);

    m_scrollProcNames = new LHSListPane(paneSp, m_lstProcNames);
    paneSp.add(m_scrollProcNames);

    paneSp.add(createProcEditPane());

    add(paneSp);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:16,代码来源:ProcGui.java

示例10: createProcEditPane

import javax.swing.JPanel; //导入方法依赖的package包/类
private JPanel createProcEditPane()
{
    JPanel paneSpEdit = new JPanel();
    paneSpEdit.setLayout(null);
    int nXStart = m_scrollProcNames.getWidth() + GuiConstants.GAP_COMPONENT;
    int nWidth = m_paneParent.getWidth() - m_scrollProcNames.getWidth() - GuiConstants.GAP_COMPONENT;
    paneSpEdit.setBounds(nXStart, 0, nWidth, m_scrollProcNames.getHeight());

    paneSpEdit.add(createProcProbabilityPane(paneSpEdit));
    paneSpEdit.add(createProcParasPane(paneSpEdit));

    return paneSpEdit;
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:14,代码来源:ProcGui.java

示例11: makeTitlePanel

import javax.swing.JPanel; //导入方法依赖的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

示例12: WebAppAddDialog

import javax.swing.JPanel; //导入方法依赖的package包/类
public WebAppAddDialog() {
	super(MainFrame.instance);

	this.setModal(true);
	int gap = 50;
	this.setLayout(null);

	this.setSize(600, 500);

	JPanel pInput = new JPanel();
	JPanel pSubmit = new JPanel();

	pInput.setLayout(new GridLayout(5, 2, gap, gap));
	pInput.add(lName);
	pInput.add(tfName);
	pInput.add(lPath);
	pInput.add(tfPath);
	pInput.add(lTestPage);
	pInput.add(tfTestPage);
	pInput.add(lStartup);
	pInput.add(cbStartup);
	pInput.add(lDeploy);
	pInput.add(cbDeploy);

	pSubmit.add(bSubmit);

	pInput.setBounds(50, 20, 400, 350);
	pSubmit.setBounds(50, 380, 400, 150);

	this.add(pInput);
	this.add(pSubmit);
	this.setLocationRelativeTo(MainFrame.instance);
	addListener();
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:35,代码来源:WebAppAddDialog.java

示例13: SignUpPanel

import javax.swing.JPanel; //导入方法依赖的package包/类
/**
 * Create the panel.
 */
public SignUpPanel() {
	setLayout(null);
	
	JLabel lblNewLabel = new JLabel("Hearthstone");
	lblNewLabel.setFont(new Font("Lucida Grande", Font.PLAIN, 35));
	lblNewLabel.setBounds(150, 35, 211, 61);
	add(lblNewLabel);
	
	JPanel panel = new JPanel();
	panel.setBorder(new LineBorder(new Color(0, 0, 0)));
	panel.setBounds(434, 20, 245, 260);
	add(panel);
	panel.setLayout(null);
	
	JLabel lblUpdateNotes = new JLabel("Update Notes:");
	lblUpdateNotes.setBounds(6, 6, 89, 16);
	panel.add(lblUpdateNotes);
	
	JTextPane txtpn_UpdateNotes = new JTextPane();
	txtpn_UpdateNotes.setEditable(false);
	txtpn_UpdateNotes.setBackground(this.getBackground());
	txtpn_UpdateNotes.setText("* Added Support for Multiplayer\n\n\n* Support for login\n\n\n* Server can hold multiple games at once");
	txtpn_UpdateNotes.setBounds(16, 34, 211, 207);
	panel.add(txtpn_UpdateNotes);
	
	JLabel label = new JLabel("Username:");
	label.setBounds(58, 103, 70, 16);
	add(label);
	
	txt_Username = new JTextField();
	txt_Username.setColumns(20);
	txt_Username.setBounds(134, 97, 254, 28);
	add(txt_Username);
	
	JLabel label_1 = new JLabel("Password:");
	label_1.setBounds(65, 151, 63, 16);
	add(label_1);
	
	psf_Password = new JPasswordField();
	psf_Password.setColumns(20);
	psf_Password.setBounds(134, 145, 254, 28);
	add(psf_Password);
	
	pwf_Retype = new JPasswordField();
	pwf_Retype.setColumns(20);
	pwf_Retype.setBounds(134, 191, 254, 28);
	add(pwf_Retype);
	
	JLabel lblRetypePassword = new JLabel("Retype Password:");
	lblRetypePassword.setBounds(19, 197, 109, 16);
	add(lblRetypePassword);
	
	btn_Login = new JButton("Login");
	btn_Login.setBounds(134, 240, 117, 29);
	add(btn_Login);
	
	btn_SignUp = new JButton("Sign Up");
	btn_SignUp.setBounds(271, 240, 117, 29);
	add(btn_SignUp);

}
 
开发者ID:ikhaliq15,项目名称:JHearthstone,代码行数:65,代码来源:SignUpPanel.java

示例14: LoginPanel

import javax.swing.JPanel; //导入方法依赖的package包/类
/**
 * Create the panel.
 */
public LoginPanel() {
	setLayout(null);
	
	jpf_Password = new JPasswordField();
	jpf_Password.setBounds(123, 188, 254, 28);
	jpf_Password.setColumns(20);
	add(jpf_Password);
	
	btn_Submit = new JButton("Login");
	btn_Submit.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent e) {
		}
	});
	btn_Submit.setBounds(123, 228, 117, 29);
	add(btn_Submit);
	
	JLabel lblPassword = new JLabel("Password:");
	lblPassword.setBounds(54, 194, 63, 16);
	add(lblPassword);
	
	JLabel lblUsername = new JLabel("Username:");
	lblUsername.setBounds(47, 127, 70, 16);
	add(lblUsername);
	
	jtf_Username = new JTextField();
	jtf_Username.setBounds(123, 121, 254, 28);
	add(jtf_Username);
	jtf_Username.setColumns(20);
	
	JPanel panel = new JPanel();
	panel.setBorder(new LineBorder(new Color(0, 0, 0)));
	panel.setBounds(434, 20, 245, 260);
	add(panel);
	panel.setLayout(null);
	
	JLabel lblUpdateNotes = new JLabel("Update Notes:");
	lblUpdateNotes.setBounds(6, 6, 89, 16);
	panel.add(lblUpdateNotes);
	
	JTextPane txtpn_UpdateNotes = new JTextPane();
	txtpn_UpdateNotes.setEditable(false);
	txtpn_UpdateNotes.setBackground(this.getBackground());
	txtpn_UpdateNotes.setText("* Added Support for Multiplayer\n\n\n* Support for login\n\n\n* Server can hold multiple games at once");
	txtpn_UpdateNotes.setBounds(16, 34, 211, 207);
	panel.add(txtpn_UpdateNotes);
	
	JLabel lblNewLabel = new JLabel("Hearthstone");
	lblNewLabel.setFont(new Font("Lucida Grande", Font.PLAIN, 35));
	lblNewLabel.setBounds(150, 35, 211, 61);
	add(lblNewLabel);
			
	btn_SignUp = new JButton("Sign Up");
	btn_SignUp.setBounds(260, 228, 117, 29);
	add(btn_SignUp);

}
 
开发者ID:ikhaliq15,项目名称:JHearthstone,代码行数:60,代码来源:LoginPanel.java

示例15: addSingleMultipleNode

import javax.swing.JPanel; //导入方法依赖的package包/类
@Override
protected DefaultMutableTreeNode addSingleMultipleNode(DefaultMutableTreeNode node, boolean isInnerClass){
	
	// --- Get all needed information about the node, which has to be copied --------
	DynType dt = (DynType) node.getUserObject();
	String clazz = dt.getClassName();
	OntologySingleClassSlotDescription oscsd = dt.getOntologySingleClassSlotDescription();
	
	JPanel oldPanel = dt.getPanel();
	JPanel parentPanel = (JPanel) oldPanel.getParent();

	// --- Get parent node ----------------------------------------------------------
	DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) node.getParent(); 
	int depth2WorkOn = parentNode.getLevel()-1;
	
	// --- Create the panel/node as needed as a copy of the current node ------------
	JPanel blindPanel = new JPanel();
	blindPanel.setLayout(null);
	DefaultMutableTreeNode newNode = null;
	
	if (isInnerClass==true) {
		newNode = this.createInnerElements(oscsd, clazz, depth2WorkOn+1, blindPanel, parentNode, true);
		if (oldPanel.isVisible()==false) {
			// --- Case special class: set invisible and small ------------ 
			this.setJPanelInvisibleAndSmall(newNode);
		}
		
	} else {
		newNode = this.createOuterElements(oscsd, depth2WorkOn, blindPanel, parentNode, true);
	}
	
	// --- Place the node at the right position in the tree -------------------------
	newNode.removeFromParent();
	int nodeIndexPos = parentNode.getIndex(node)+1;
	objectTree.insertNodeInto(newNode, parentNode, nodeIndexPos);
	
	// --- Set the size of the new Panel --------------------------------------------
	DynType dtNew = (DynType) newNode.getUserObject();
	JPanel newPanel = dtNew.getPanel();
	
	// --- Layout the new panel -----------------------------------------------------
	if (oldPanel.isVisible()==true) {
		// ----------------------------------------------------------------
		// --- The normal case for visible classes ------------------------
		// ----------------------------------------------------------------			
		this.setPanelBounds(newPanel);
		newPanel.setPreferredSize(newPanel.getSize());

		// --- Now place the new sub panel on the right super panel -------
		int movement = oldPanel.getHeight() + 2;
		int xPos = oldPanel.getX();
		int yPos = oldPanel.getY() + movement;
		newPanel.setBounds(xPos, yPos, newPanel.getWidth(), newPanel.getHeight());
		
		// --- Add to parent panel ----------------------------------------
		parentPanel.add(newPanel);
		parentPanel.validate();
		this.setPanelBounds(parentPanel);
		
		// --- Now move the rest of the elements on the form ----------------------------
		this.moveAfterAddOrRemove(movement, newNode);
		
	} else {
		// ----------------------------------------------------------------
		// --- The case for special classes, that have to be invisible ----
		// ----------------------------------------------------------------
		newPanel.setVisible(false);
		newPanel.setBounds(oldPanel.getBounds());
		
	}
	
	// --- refresh the GUI ----------------------------------------------------------
	this.adjustPreferredSize();
	
	return newNode;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:77,代码来源:DynForm.java


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