Skip to content

Commit

Permalink
try to implement tooltip support
Browse files Browse the repository at this point in the history
  • Loading branch information
karolherbst committed May 14, 2013
1 parent 8b66442 commit 06299bf
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions src/main/java/org/sexydock/tabs/jhrome/JhromeTabbedPaneUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -434,16 +434,7 @@ public void actionPerformed( ActionEvent e )
@Override
public void actionPerformed( ActionEvent e )
{
if( tabFactory == null )
{
return;
}
Tab newTab = tabFactory.createTabWithContent( );
if( newTab != null )
{
tabbedPane.addTab( newTab.getTitle( ) , newTab.getContent( ) );
tabbedPane.setSelectedComponent( newTab.getContent( ) );
}
createNewTab();
}
};

Expand Down Expand Up @@ -490,6 +481,20 @@ public void actionPerformed( ActionEvent e )
installKeyboardActions( );
}

public void createNewTab()
{
if( tabFactory == null )
{
return;
}
Tab newTab = tabFactory.createTabWithContent( );
if( newTab != null )
{
tabbedPane.addTab( newTab.getTitle( ) , null , newTab.getContent( ) , newTab.getToolTipText( ) );
tabbedPane.setSelectedComponent( newTab.getContent( ) );
}
}

public ITabFactory getTabFactory( )
{
return tabFactory;
Expand Down Expand Up @@ -2322,6 +2327,7 @@ private void updateTab( int vIndex , boolean createIfNecessary )
Color foreground = tabbedPane.getForegroundAt( vIndex );
boolean selected = tabbedPane.getSelectedIndex( ) == vIndex;
boolean enabled = tabbedPane.isEnabledAt( vIndex );
String tooltip = tabbedPane.getToolTipTextAt( vIndex );

Tab tab = null;
TabInfo info = contentMap.get( content );
Expand All @@ -2346,6 +2352,7 @@ else if( createIfNecessary )
tab.setEnabled( enabled );
tab.setBackground( background );
tab.setForeground( foreground );
tab.setToolTipText( tooltip );

if( info != null )
{
Expand Down

0 comments on commit 06299bf

Please sign in to comment.