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

The following are Jave code examples for showing how to use setBounds() of the javax.swing.JPanel 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: GamingPlatform   File: GiocoRecensioniView.java   View Source Code Vote up 7 votes
/**
 * 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);
	}});
}
 
Example 2
Project: AgentWorkbench   File: DynForm.java   View Source Code Vote up 6 votes
/**
 * 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);

}
 
Example 3
Project: sstore-soft   File: TableGui.java   View Source Code Vote up 6 votes
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();
}
 
Example 4
Project: sstore-soft   File: TableGui.java   View Source Code Vote up 6 votes
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;
}
 
Example 5
Project: FreeCol   File: InfoPanel.java   View Source Code Vote up 6 votes
/**
 * 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();
}
 
Example 6
Project: s-store   File: ProcGui.java   View Source Code Vote up 6 votes
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;
}
 
Example 7
Project: s-store   File: TableGui.java   View Source Code Vote up 6 votes
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;
}
 
Example 8
Project: COE1186   File: TrackModelGUI.java   View Source Code Vote up 5 votes
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);
}
 
Example 9
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 10
Project: sstore-soft   File: ProcGui.java   View Source Code Vote up 5 votes
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);
}
 
Example 11
Project: sstore-soft   File: ProcGui.java   View Source Code Vote up 5 votes
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;
}
 
Example 12
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 13
Project: COE1186   File: TrackModelGUI.java   View Source Code Vote up 5 votes
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);
}
 
Example 14
Project: s-store   File: ProcGui.java   View Source Code Vote up 5 votes
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;
}
 
Example 15
Project: lazycat   File: WebAppAddDialog.java   View Source Code Vote up 5 votes
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();
}
 
Example 16
Project: JHearthstone   File: SignUpPanel.java   View Source Code Vote up 4 votes
/**
 * 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);

}
 
Example 17
Project: JHearthstone   File: LoginPanel.java   View Source Code Vote up 4 votes
/**
 * 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);

}
 
Example 18
Project: AgentWorkbench   File: DynForm.java   View Source Code Vote up 4 votes
@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;
}
 
Example 19
Project: AgentWorkbench   File: DynForm.java   View Source Code Vote up 4 votes
/**
 * Move all elements which are available after the node given by the parameter node.
 *
 * @param movement the movement
 * @param node the node
 */
private void moveAfterAddOrRemove(int movement, DefaultMutableTreeNode node) {
	
	if (node==this.getRootNode()) return;
	
	DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) node.getParent();
	JPanel parentPanel = null;
	if (parentNode.getUserObject() instanceof DynType) {
		DynType dynType = (DynType) parentNode.getUserObject();
		parentPanel = dynType.getPanel();
	}
	
	int numOfChilds = parentNode.getChildCount();
	int indexOfNextNode = parentNode.getIndex(node) + 1;
	
	for (int i = indexOfNextNode; i < numOfChilds; i++) {
		
		DefaultMutableTreeNode currNode = (DefaultMutableTreeNode) parentNode.getChildAt(i);

		DynType dt = (DynType) currNode.getUserObject();
		JPanel movePanel = dt.getPanel();
		movePanel.setBounds(movePanel.getX(), movePanel.getY()+movement, movePanel.getWidth(), movePanel.getHeight());
		
		JComponent parentComp = (JComponent) movePanel.getParent();
		parentComp.validate();
		if (parentComp instanceof JPanel) {
			this.setPanelBounds((JPanel) parentComp);	
		}
		
	}

	// --- Configure size of parent panel -----------------------
	if (parentPanel!=null) {
		parentPanel.validate();
		this.setPanelBounds(parentPanel);
	}
	
	// --- do the same at the parent node -----------------------
	this.moveAfterAddOrRemove(movement, parentNode);
	
}
 
Example 20
Project: LinkGame   File: ModeDialog.java   View Source Code Vote up 4 votes
private void init() {
	getContentPane().setLayout(null);

	JPanel panel = new JPanel();
	panel.setBorder(new TitledBorder(null, "游戏模式", TitledBorder.LEADING, TitledBorder.TOP,
			null, null));
	panel.setBounds(23, 25, 383, 59);
	getContentPane().add(panel);
	panel.setLayout(null);

	single = new JRadioButton("单机");
	single.setBounds(40, 18, 68, 23);
	panel.add(single);

	/*fight = new JRadioButton("对战");
	fight.setBounds(149, 18, 78, 23);
	panel.add(fight);

	together = new JRadioButton("合作");
	together.setBounds(243, 18, 78, 23);
	panel.add(together);*/
	
	ButtonGroup group = new ButtonGroup();
	group.add(single);
	group.add(fight);
	group.add(together);
	switch (SharedVar.game_mode) {
	case Constants.MODE_SINGLE:
		single.setSelected(true);
		break;
	case Constants.MODE_FIGHT:
		fight.setSelected(true);
		break;
	case Constants.MODE_TOGETHER:
		together.setSelected(true);
		break;
	default:
		break;
	}

	confirm = new JButton("确定");
	confirm.setBounds(157, 104, 93, 23);
	confirm.addActionListener(this);
	getContentPane().add(confirm);

	cancel = new JButton("取消");
	cancel.setBounds(295, 104, 93, 23);
	cancel.addActionListener(this);
	getContentPane().add(cancel);
}