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


Java JPanel.setToolTipText方法代碼示例

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


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

示例1: About

import javax.swing.JPanel; //導入方法依賴的package包/類
/**
 * Create the frame.
 */
public About() {
	ImageIcon img = new ImageIcon("icon.PNG");
	this.setIconImage(img.getImage());
	this.setTitle("About");
	setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
	setBounds(100, 100, 705, 335);
	contentPane = new JPanel();
	contentPane.setBackground(SystemColor.activeCaptionBorder);
	contentPane.setToolTipText("erh");
	contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
	setContentPane(contentPane);
	contentPane.setLayout(null);
	
	JTextPane txtpnByIkerGarca = new JTextPane();
	txtpnByIkerGarca.setBackground(SystemColor.menu);
	txtpnByIkerGarca.setEditable(false);
	txtpnByIkerGarca.setText("By: Iker Garc\u00EDa Ferrero\r\nDate: 03/01/2017\r\n\r\n--Contact--\r\nMail: [email protected] \r\n\r\nThe source code can be found here:\r\nhttps://github.com/ikergarcia1996/Simple-AI_Ikerg-app_INTELLIGENT_POINTS\r\n\r\nA demostration and explanation can be found here (Spanish):\r\nhttps://www.youtube.com/hardware360grados\r\n\r\nThis program uses Processing 3.2.3\r\n\r\nCopyright 2017 Iker Garc\u00EDa \"Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)\" ");
	txtpnByIkerGarca.setToolTipText("");
	txtpnByIkerGarca.setBounds(12, 13, 664, 262);
	contentPane.add(txtpnByIkerGarca);
}
 
開發者ID:ikergarcia1996,項目名稱:Genetic-Algorithm-Path-Finder,代碼行數:25,代碼來源:About.java

示例2: 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

示例3: getListCellRendererComponent

import javax.swing.JPanel; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public Component getListCellRendererComponent(JList<? extends BuildableType> list,
                BuildableType value,
                int index,
                boolean isSelected,
                boolean cellHasFocus) {
    JPanel panel = (isSelected) ? selectedPanel : itemPanel;
    panel.removeAll();

    ((ImageIcon)imageLabel.getIcon()).setImage(ImageLibrary.getBuildableImage(value, buildingDimension));

    nameLabel.setText(Messages.getName(value));
    panel.setToolTipText(lockReasons.get(value));
    panel.add(imageLabel, "span 1 2");
    if (lockReasons.get(value) == null) {
        panel.add(nameLabel, "wrap");
    } else {
        panel.add(nameLabel, "split 2");
        panel.add(lockLabel, "wrap");
    }

    ImageLibrary lib = getImageLibrary();
    List<AbstractGoods> required = value.getRequiredGoodsList();
    int size = required.size();
    for (int i = 0; i < size; i++) {
        AbstractGoods goods = required.get(i);
        ImageIcon icon = new ImageIcon(lib.getSmallIconImage(goods.getType()));
        JLabel goodsLabel = new JLabel(Integer.toString(goods.getAmount()), icon, SwingConstants.CENTER);
        if (i == 0 && size > 1) {
            panel.add(goodsLabel, "split " + size);
        } else {
            panel.add(goodsLabel);
        }
    }
    return panel;
}
 
開發者ID:FreeCol,項目名稱:freecol,代碼行數:40,代碼來源:BuildQueuePanel.java


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