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

The following are Jave code examples for showing how to use setToolTipText() 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: Genetic-Algorithm-Path-Finder   File: About.java   View Source Code Vote up 6 votes
/**
 * 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);
}
 
Example 2
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 3
Project: freecol   File: BuildQueuePanel.java   View Source Code Vote up 5 votes
/**
 * {@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;
}
 
Example 4
Project: FreeCol   File: BuildQueuePanel.java   View Source Code Vote up 5 votes
/**
 * {@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;
}