本文整理汇总了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);
}
示例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);
}
示例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;
}