当前位置: 首页>>代码示例>>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;未经允许,请勿转载。