jcombox中tooltip的新使用

MyComboBox setUI()
		{
			setUI(new BasicComboBoxUI()
			{
				
				@Override
				protected ComboPopup createPopup()
				{
					ComboPopup pop = new BasicComboPopup(comboBox)
					{

						private static final long serialVersionUID = 284596993223L;

						@Override
						protected JScrollPane createScroller()
						{
							ToolTipManager tm = ToolTipManager.sharedInstance();
							tm.setInitialDelay(50);
							tm.setDismissDelay(1000);
							list.setBackground(new Color(255,153,51));
							list.addListSelectionListener(new ListSelectionListener()
									{
										public void valueChanged(
												ListSelectionEvent e)
										{
											String value = list
													.getSelectedValue()
													.toString();
											list.setToolTipText(value);
										}

									});
							return new JScrollPane(list,
									JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
									JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
						}

					};
					return pop;
				}

			});
			return this;
		}

 

你可能感兴趣的:(tooltip)