當前位置: 首頁>>代碼示例>>Java>>正文


Java JPanel.remove方法代碼示例

本文整理匯總了Java中javax.swing.JPanel.remove方法的典型用法代碼示例。如果您正苦於以下問題:Java JPanel.remove方法的具體用法?Java JPanel.remove怎麽用?Java JPanel.remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.JPanel的用法示例。


在下文中一共展示了JPanel.remove方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: clear

import javax.swing.JPanel; //導入方法依賴的package包/類
public static void clear(JPanel paneColEdit)
{
    if (paneColEdit.getComponentCount() == 1)
    {
        paneColEdit.remove(0);
        paneColEdit.updateUI();
    }
}
 
開發者ID:s-store,項目名稱:s-store,代碼行數:9,代碼來源:RandomDistributionEditorManager.java

示例2: removeMultiple

import javax.swing.JPanel; //導入方法依賴的package包/類
@Override
protected void removeMultiple(DefaultMutableTreeNode node){
	
	// --- Remind all needed informations -------------------------------------------
	DefaultMutableTreeNode previousNode = node.getPreviousNode();
	DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) node.getParent();
	
	DynType dt = (DynType) node.getUserObject();
	JPanel deletePanel = dt.getPanel();
	JPanel parentPanel = (JPanel) deletePanel.getParent();
	
	int movement = (deletePanel.getHeight() + 2) * (-1);
	
	// --- Remove node from the parent node and panel -------------------------------
	DynType dyntype = (DynType) node.getUserObject();
	node.setUserObject(null);
	parentNode.remove(node);
	this.getTreeNodesByDynType().remove(dyntype);
	
	// --- remove the panel from the parent -----------------------------------------
	parentPanel.remove(deletePanel);
	parentPanel.validate();
	this.setPanelBounds(parentPanel);
	
	// --- Now move the rest of the elements on the form ----------------------------
	this.moveAfterAddOrRemove(movement, previousNode);

	// --- refresh the GUI ----------------------------------------------------------
	this.adjustPreferredSize();
	
}
 
開發者ID:EnFlexIT,項目名稱:AgentWorkbench,代碼行數:32,代碼來源:DynForm.java

示例3: startRename

import javax.swing.JPanel; //導入方法依賴的package包/類
private void startRename() {
	
	// init the text box
	final JTextField text = new JTextField();
	text.setText(m_reference.getNamableName());
	text.setPreferredSize(new Dimension(360, text.getPreferredSize().height));
	text.addKeyListener(new KeyAdapter() {
		@Override
		public void keyPressed(KeyEvent event) {
			switch (event.getKeyCode()) {
				case KeyEvent.VK_ENTER:
					finishRename(text, true);
				break;
				
				case KeyEvent.VK_ESCAPE:
					finishRename(text, false);
				break;
			}
		}
	});
	
	// find the label with the name and replace it with the text box
	JPanel panel = (JPanel)m_infoPanel.getComponent(0);
	panel.remove(panel.getComponentCount() - 1);
	panel.add(text);
	text.grabFocus();
	text.selectAll();
	
	redraw();
}
 
開發者ID:cccssw,項目名稱:enigma-vk,代碼行數:31,代碼來源:Gui.java

示例4: finishRename

import javax.swing.JPanel; //導入方法依賴的package包/類
private void finishRename(JTextField text, boolean saveName) {
	String newName = text.getText();
	if (saveName && newName != null && newName.length() > 0) {
		try {
			m_controller.rename(m_reference, newName);
		} catch (IllegalNameException ex) {
			text.setBorder(BorderFactory.createLineBorder(Color.red, 1));
			text.setToolTipText(ex.getReason());
			GuiTricks.showToolTipNow(text);
		}
		return;
	}
	
	// abort the rename
	JPanel panel = (JPanel)m_infoPanel.getComponent(0);
	panel.remove(panel.getComponentCount() - 1);
	panel.add(GuiTricks.unboldLabel(new JLabel(m_reference.getNamableName(), JLabel.LEFT)));
	
	m_editor.grabFocus();
	
	redraw();
}
 
開發者ID:cccssw,項目名稱:enigma-vk,代碼行數:23,代碼來源:Gui.java


注:本文中的javax.swing.JPanel.remove方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。