Icon and a button in JTabbedPane Tabs

Hi,
i want to put an icon on the left side of the text and a button on the right side(Same as the eclipse tabs). Can any one help me how to do this.
thnx in advance.

Search the forum using "jtabbedpane close icon" for other discussions on this topic.

Similar Messages

  • I can not delete or compose an email on iphone 5.  The icon and delete button are not on the screen.

    I can not delete or compose an email on iphone 5.  The icon and delete button are not on the screen.

    I had the same problem.  I completely powered down the iphone and then powered it back up.  I then had the bar at the bottom of the email app that I think you are looking for.
    iPhone5, OS6

  • Button in JTabbedPane tab

    Greetings,
    i'd like to have a button on every tab in JTabbedPane, like close button in NetBeans when you edit the code. By default, you can put an icon only. Do you guys know how to do that?
    thanks in advence.

    If you can wait another couple of months (or if you are willing to use the beta version), you can use the new JTabbedPane features in Java 6 (Mustang). Have a look at the method setTabComponentAt:
    [url http://download.java.net/jdk6/docs/api/javax/swing/JTabbedPane.html#setTabComponentAt(int,%20java.awt.Component)]setTabComponentAt

  • My problem is close and minimize buttons on the tabs.

    The minimize and close buttons are working fine on the main screen. When I open tabs I cannot minimize them. I keep going up to minimize and I end up closing out the tab that I wanted.

    Did you have any luck figuring this out? It just started happening on my wife's iPhone 5. Restoring to factory settings did nothing. One repair shop in my town thought it was the main chip going out.

  • JTabbedPane and one Button for all Tabs

    Hello everybody,
    im new here an would say HELLOOO to everyone
    So ive got an issue.
    I am creating in "class A"  tabs for a JTabbedPane. In "class B" i create the JTabbedPane and creat instances of class A and add them to the TabbedPane.
    in Class B i also create a button, for save actions. When i click the button, a method "save()" will be called and read from every tab the Strings out of textfields.
    My problem now is, that it dont work, i call the save method with the instance from the tab, but it dont getText() from the textfield.
    For example:
    //create an instance tab, parameter is the save file
    Tab myTab = new Tab(file);
         //other code
    (Tab)myTab.save(); //here i eclipse cast to Tab automatically
    the save-Method in class A (Tab):
    save() {
    sysout(texfield1.getText)
    BTW how can i highlight code in this forum?

    You can add syntax highlighting by going into the advanced editor, that will add a button for it. Unfortunately there are no quick code tags :/
    After you find the button post your ACTUAL code. not just some random snippet which looks like your code. What you posted doesn't even compile.

  • Why are my header icons and toolbar buttons grayed out?

    I purchased a used Macbook Pro from ebay.  Appeared to be in good working order when I first started working with it, but I have updated from OS X 10.9.2 to 10.9.5 and downloaded Open Office program, set up my mail and went through the system preferences and personalized it.  Also ran disk utilities.  Then, this AM, when I restarted, the header icons on the right side are grayed out except for the battery %, the date and time and notifications.  Also, in mail and safari, the toolbar buttons are blank (forward, back, print, mail, bookmarks, autofil, history and downloads).  What happened?  I went to the disk utility from the recovery partition (repaired disk and disk permissions).  I also reset parameters.  Don't know what to do next.  Not sure if this is a hardware or software problem, but I am assuming it is software (OS X) related at this point.  Please help.

      Start up in Safe Mode.
      http://support.apple.com/kb/PH14204?viewlocale=en_US
    Giving away / Selling your Mac / Resetting  the computer to the factory condition
    http://support.apple.com/kb/HT5189
    http://www.thesafemac.com/how-to-prepare-your-mac-for-sale/

  • In FF 7.0.1, the New Tab button on the Tab Strip disappeared after clicking the Tab Group icon and trying to return, so I'm looking for advice on how to get the New Tab to reappear on the Tab Strip.

    In Windows Vista, FF 7.0.1, I selected the Tab Group button to try it out. However, when I selected the Tab Group button again to close that view, the New Tab button in the Tab Strip no longer appears. I'm requesting help to restore the New Tab button (has the "+" sign on it) on the Tab Strip just to the right of the currently open tabs.

    You can find the New Tab button showing as a '+' on the Tab bar.
    You can open the Customize window and drag the New Tab button that shows as a plus sign (+) from the Tab bar on another toolbar and it will become a regular toolbar button like the New Tab button that you have in Firefox 3 versions.<br />
    Open the Customize window via "View > Toolbars > Customize" or via "Firefox > Options > Toolbar Layout"
    If you can't find the New Tab button then click the "Restore Default Set" button in the Customize window.
    If you want the New Tab button at the far right end of the Tab bar then place a flexible space to the left of it.

  • JTabbedPane with one close button for all tabs

    Hello,
    there have several solutions been posted for JTabbedPane subclasses that provide tabs with icons working as close buttons on each tab. I think this is not user friendly because the user can hit the close button accidentally when selecting a tab. And a "really close?" dialog is clumsy.
    Therefore I prefer the Netscape browser style: There's only one close button rightmost of the tabs that closes the selected tab. But I don't have an idea how to achieve this.
    Does anyone have a solution or an idea? Thanks in advance for help.

    This solution has been posted several times and is not what I wanted. But I rewrote the thing so that
    - the close buttons are on the right hand side of each tab so that it is conformant with Eclipse style, and
    - the close buttons work only with a left click (see code below).
    I just wonder how I can move the text a little bit to the left so that the appearence is a bit more balanced. Can someone help, please?
    import java.awt.Color;
    import java.awt.FontMetrics;
    import java.awt.Graphics;
    import java.awt.Rectangle;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import javax.swing.plaf.basic.BasicTabbedPaneUI;
    class TabbedPaneCloseButtonUI extends BasicTabbedPaneUI {
        public TabbedPaneCloseButtonUI() {
            super();
        protected void paintTab(
            Graphics g,
            int tabPlacement,
            Rectangle[] rects,
            int tabIndex,
            Rectangle iconRect,
            Rectangle textRect) {
            super.paintTab(g, tabPlacement, rects, tabIndex, iconRect, textRect);
            Rectangle rect = rects[tabIndex];
            g.setColor(Color.black);
            g.drawRect(rect.x + rect.width -19, rect.y + 4, 13, 12);
            g.drawLine(
                rect.x + rect.width -16,
                rect.y + 7,
                rect.x + rect.width -10,
                rect.y + 13);
            g.drawLine(
                rect.x + rect.width -10,
                rect.y + 7,
                rect.x + rect.width -16,
                rect.y + 13);
            g.drawLine(
                rect.x + rect.width -15,
                rect.y + 7,
                rect.x + rect.width -9,
                rect.y + 13);
            g.drawLine(
                rect.x + rect.width -9,
                rect.y + 7,
                rect.x + rect.width -15,
                rect.y + 13);
        protected int calculateTabWidth(
            int tabPlacement,
            int tabIndex,
            FontMetrics metrics) {
            return super.calculateTabWidth(tabPlacement, tabIndex, metrics) + 24;
        protected MouseListener createMouseListener() {
            return new MyMouseHandler();
        class MyMouseHandler extends MouseHandler {
            public MyMouseHandler() {
                super();
            public void mouseReleased(MouseEvent e) {
                int x = e.getX();
                int y = e.getY();
                int tabIndex = -1;
                int tabCount = tabPane.getTabCount();
                for (int i = 0; i < tabCount; i++) {
                    if (rects.contains(x, y)) {
    tabIndex = i;
    break;
         if (tabIndex >= 0 && ! e.isPopupTrigger()) {
    Rectangle tabRect = rects[tabIndex];
    y = y - tabRect.y;
    if ((x >= tabRect.x + tabRect.width - 18)
    && (x <= tabRect.x + tabRect.width - 8)
    && (y >= 5)
    && (y <= 15)) {
    tabPane.remove(tabIndex);
    import java.awt.BorderLayout;
    import javax.swing.ImageIcon;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JTabbedPane;
    public class TabbedPaneWithCloseButtons {
    JFrame frame;
    JTabbedPane tabPane;
    public TabbedPaneWithCloseButtons() throws Exception {
    frame=new JFrame();
    frame.getContentPane().setLayout(new BorderLayout());
    tabPane=new JTabbedPane();
    tabPane.addTab("test1xxxxxxxxxxxxxx", new JLabel("1"));
    tabPane.addTab("test2xxxxxxxxxxxxxxxxxxx", new ImageIcon("images/icon.gif"), new JLabel("2"));
    tabPane.addTab("test3xxxxxxxx", new JLabel("3"));
    tabPane.setUI(new TabbedPaneCloseButtonUI());
    frame.getContentPane().add(tabPane);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(200,200);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
    public static void main(String[] args) throws Exception {
    TabbedPaneWithCloseButtons test=new TabbedPaneWithCloseButtons();

  • When i want to return to my home page I click on the home icon and it resets the page to my home page but also open a blak tab which i don't want how can I stop this as i have too many tabs open.

    When I want to return to my home page after looking at a website I click on the home icon and it resets the page to my home page but also open a blak tab which i don't want.How can I stop this as I have too many tabs open and have to close all of them.

    You may have an unwanted extension that is modifying sites (or the toolbar area). Try this:
    Disable ALL nonessential or unrecognized extensions on the Add-ons page. Either:
    * Ctrl+Shift+a
    * orange Firefox button (or Tools menu) > Add-ons
    In the left column, click Extensions. Then, if in doubt, disable.
    Usually a link will appear above at least one disabled extension to restart Firefox. You can complete your work on the tab and click one of the links as the last step.
    Does that flush the tab?
    Please report back on anything suspicious you find so others can learn about its bad behavior.

  • Add button to JTabbedPane to add new tab

    Does anyone know how to add a JButton to a JTabbed pane (in the tab bar) so that it is always at the end of all the tabs and when it is clicked it will add a new tab into the tabbed pane.
    The functionallity I am looking for is the same as that provided by the button in the tab bar for Firefox and Internet Explorer.

    Along the line of what TBM was saying:
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.event.*;
    class NewTabDemo implements Runnable
      JTabbedPane tabs;
      ChangeListener listener;
      int numTabs;
      public static void main(String[] args)
        SwingUtilities.invokeLater(new NewTabDemo());
      public void run()
        listener = new ChangeListener()
          public void stateChanged(ChangeEvent e)
            addNewTab();
        tabs = new JTabbedPane();
        tabs.add(new JPanel(), "Tab " + String.valueOf(numTabs), numTabs++);
        tabs.add(new JPanel(), "+", numTabs++);
        tabs.addChangeListener(listener);
        JFrame frame = new JFrame(this.getClass().getName());
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().add(tabs, BorderLayout.CENTER);
        frame.pack();
        frame.setSize(new Dimension(400,200));
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
      private void addNewTab()
        int index = numTabs-1;
        if (tabs.getSelectedIndex() == index)
          tabs.add(new JPanel(), "Tab " + String.valueOf(index), index);
          tabs.removeChangeListener(listener);
          tabs.setSelectedIndex(index);
          tabs.addChangeListener(listener);
          numTabs++;
    }

  • UIX: How to get tooltip help on tabs and global buttons?

    Our users love tooltip help (the yellow pop-up help text that is displayed when you hold the mouse above an image or hyperlink). The shortDesc attribute sets the tooltip help on most elements. But it doesn't seem to work for (level 1) tabs (i.e. a link element within a tabBar within tabs) and global buttons (i.e. a globalButton element). Is this just not implemented by the UIX renderers or am i missing something?

    Adam,
    We are NOT using UIX JSP. We have written our
    own controller and our render actions take the UIX file
    and call the UIX API's to render the page.
    In UIX we have the following definition of a global button:
    <globalButton icon="images/uitloggen.gif" destination="javascript:go1('global_uitloggen')" shortDesc="uitloggen"/>
    It generates (renders as):
    <img src="images/uitloggen.gif" border="0">
    Note that there is no "alt" attribute in the "img" element.
    In UIX we have the following definition of a link within a tabs and tabBar element:
    <link text="bestelling" destination="javascript:go1('global_bestellen')"
    data:rendered="CLU_BESTELLEN@cqj2ee:USERPRIVS" shortDesc="Hier kunt u ..."/>
    It generates (renders as):
    <area shape="poly" coords="107,21,118,0,194,0,202,8,202,21" alt="Selecteer deze optie om te gaan naar bestelling." href="javascript:go1('global_bestellen')">
    Note that the "alt" attribute has a generated text and doesn't use the value of the shortDesc attribute
    in the link element in UIX.

  • Adding Icon and increasing width of tabpages to show the close button in a tabcontrol

    I have this code right now,
    Public Class FSMTabControl
    Inherits TabControl
    #Region "Declarations"
    Private _TextColour As Color = Color.FromArgb(255, 255, 255)
    Private _BackTabColour As Color = Color.FromArgb(54, 54, 54)
    Private _BaseColour As Color = Color.FromArgb(35, 35, 35)
    Private _ActiveColour As Color = Color.FromArgb(47, 47, 47)
    Private _BorderColour As Color = Color.FromArgb(30, 30, 30)
    Private _UpLineColour As Color = Color.FromArgb(0, 160, 199)
    Private _HorizLineColour As Color = Color.FromArgb(23, 119, 151)
    Private CenterSF As New StringFormat With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center}
    #End Region
    #Region "Properties"
    <Category("Colours")> _
    Public Property BorderColour As Color
    Get
    Return _BorderColour
    End Get
    Set(value As Color)
    _BorderColour = value
    End Set
    End Property
    <Category("Colours")> _
    Public Property UpLineColour As Color
    Get
    Return _UpLineColour
    End Get
    Set(value As Color)
    _UpLineColour = value
    End Set
    End Property
    <Category("Colours")> _
    Public Property HorizontalLineColour As Color
    Get
    Return _HorizLineColour
    End Get
    Set(value As Color)
    _HorizLineColour = value
    End Set
    End Property
    <Category("Colours")> _
    Public Property TextColour As Color
    Get
    Return _TextColour
    End Get
    Set(value As Color)
    _TextColour = value
    End Set
    End Property
    <Category("Colours")> _
    Public Property BackTabColour As Color
    Get
    Return _BackTabColour
    End Get
    Set(value As Color)
    _BackTabColour = value
    End Set
    End Property
    <Category("Colours")> _
    Public Property BaseColour As Color
    Get
    Return _BaseColour
    End Get
    Set(value As Color)
    _BaseColour = value
    End Set
    End Property
    <Category("Colours")> _
    Public Property ActiveColour As Color
    Get
    Return _ActiveColour
    End Get
    Set(value As Color)
    _ActiveColour = value
    End Set
    End Property
    Protected Overrides Sub CreateHandle()
    MyBase.CreateHandle()
    Alignment = TabAlignment.Bottom
    End Sub
    #End Region
    #Region "Draw Control"
    Sub New()
    SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
    ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer, True)
    DoubleBuffered = True
    Font = New Font("Segoe UI", 10)
    SizeMode = TabSizeMode.FillToRight
    ItemSize = New Size(240, 32)
    End Sub
    Protected Overrides Sub OnPaint(e As PaintEventArgs)
    Dim g = e.Graphics
    With G
    .SmoothingMode = SmoothingMode.HighQuality
    .PixelOffsetMode = PixelOffsetMode.HighQuality
    .TextRenderingHint = TextRenderingHint.ClearTypeGridFit
    .Clear(_BaseColour)
    Try : SelectedTab.BackColor = _BackTabColour : Catch : End Try
    Try : SelectedTab.BorderStyle = BorderStyle.FixedSingle : Catch : End Try
    .DrawRectangle(New Pen(_BorderColour, 2), New Rectangle(0, 0, Width, Height))
    For i = 0 To TabCount - 1
    Dim Base As New Rectangle(New Point(GetTabRect(i).Location.X, GetTabRect(i).Location.Y), New Size(GetTabRect(i).Width, GetTabRect(i).Height))
    Dim BaseSize As New Rectangle(Base.Location, New Size(Base.Width, Base.Height))
    If i = SelectedIndex Then
    .FillRectangle(New SolidBrush(_BaseColour), BaseSize)
    .FillRectangle(New SolidBrush(_ActiveColour), New Rectangle(Base.X + 1, Base.Y - 3, Base.Width, Base.Height + 5))
    .DrawString(TabPages(i).Text, Font, New SolidBrush(_TextColour), New Rectangle(Base.X + 7, Base.Y, Base.Width - 3, Base.Height), CenterSF)
    .DrawLine(New Pen(_HorizLineColour, 2), New Point(Base.X + 3, CInt(Base.Height / 2 + 2)), New Point(Base.X + 9, CInt(Base.Height / 2 + 2)))
    .DrawLine(New Pen(_UpLineColour, 2), New Point(Base.X + 3, Base.Y - 3), New Point(Base.X + 3, Base.Height + 5))
    Else
    .DrawString(TabPages(i).Text, Font, New SolidBrush(_TextColour), BaseSize, CenterSF)
    End If
    Next
    .InterpolationMode = InterpolationMode.HighQualityBicubic
    End With
    End Sub
    Private Declare Auto Function SetParent Lib "user32" (ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As IntPtr
    Protected CloseButtonCollection As New Dictionary(Of Button, TabPage)
    Private _ShowCloseButtonOnTabs As Boolean = True
    <Browsable(True), DefaultValue(True), Category("Behavior"), Description("Indicates whether a close button should be shown on each TabPage")> _
    Public Property ShowCloseButtonOnTabs() As Boolean
    Get
    Return _ShowCloseButtonOnTabs
    End Get
    Set(ByVal value As Boolean)
    _ShowCloseButtonOnTabs = value
    For Each btn In CloseButtonCollection.Keys
    btn.Visible = _ShowCloseButtonOnTabs
    Next
    RePositionCloseButtons()
    End Set
    End Property
    Protected Overrides Sub OnCreateControl()
    MyBase.OnCreateControl()
    RePositionCloseButtons()
    End Sub
    Protected Overrides Sub OnControlAdded(ByVal e As System.Windows.Forms.ControlEventArgs)
    MyBase.OnControlAdded(e)
    Dim tp As TabPage = DirectCast(e.Control, TabPage)
    Dim rect As Rectangle = Me.GetTabRect(Me.TabPages.IndexOf(tp))
    Dim btn As Button = AddCloseButton(tp)
    btn.Size = New Size(CInt(rect.Height / 2), CInt(rect.Height / 2))
    btn.Location = New Point(rect.X + rect.Width - rect.Height + 11, CInt(rect.Y + 7))
    SetParent(btn.Handle, Me.Handle)
    AddHandler btn.Click, AddressOf OnCloseButtonClick
    CloseButtonCollection.Add(btn, tp)
    End Sub
    Protected Overrides Sub OnControlRemoved(ByVal e As System.Windows.Forms.ControlEventArgs)
    Dim btn As Button = CloseButtonOfTabPage(DirectCast(e.Control, TabPage))
    RemoveHandler btn.Click, AddressOf OnCloseButtonClick
    CloseButtonCollection.Remove(btn)
    SetParent(btn.Handle, Nothing)
    btn.Dispose()
    MyBase.OnControlRemoved(e)
    End Sub
    Protected Overrides Sub OnLayout(ByVal levent As System.Windows.Forms.LayoutEventArgs)
    MyBase.OnLayout(levent)
    RePositionCloseButtons()
    End Sub
    Public Event CloseButtonClick As CancelEventHandler
    Protected Overridable Sub OnCloseButtonClick(ByVal sender As Object, ByVal e As EventArgs)
    If Not DesignMode Then
    Dim btn As Button = DirectCast(sender, Button)
    Dim tp As TabPage = CloseButtonCollection(btn)
    Dim ee As New CancelEventArgs
    RaiseEvent CloseButtonClick(sender, ee)
    If Not ee.Cancel Then
    Me.TabPages.Remove(tp)
    RePositionCloseButtons()
    End If
    End If
    End Sub
    Protected Overridable Function AddCloseButton(ByVal tp As TabPage) As Button
    Dim closeButton As New Button
    With closeButton
    '' TODO: Give a good visual appearance to the Close button, maybe by assigning images etc.
    '' Here I have not used images to keep things simple.
    .Text = "X"
    .FlatStyle = FlatStyle.Flat
    .BackColor = _BaseColour
    .ForeColor = Color.White
    .Font = New Font("Microsoft Sans Serif", 6, FontStyle.Bold)
    End With
    Return closeButton
    End Function
    Public Sub RePositionCloseButtons()
    For Each item In CloseButtonCollection
    RePositionCloseButtons(item.Value)
    Next
    End Sub
    Public Sub RePositionCloseButtons(ByVal tp As TabPage)
    Dim btn As Button = CloseButtonOfTabPage(tp)
    If btn IsNot Nothing Then
    Dim tpIndex As Integer = Me.TabPages.IndexOf(tp)
    If tpIndex >= 0 Then
    Dim rect As Rectangle = Me.GetTabRect(tpIndex)
    If Me.SelectedTab Is tp Then
    btn.BackColor = Color.Red
    btn.Size = New Size(CInt(rect.Height / 2), CInt(rect.Height / 2))
    btn.Location = New Point(rect.X + rect.Width - rect.Height + 11, CInt(rect.Y + 7))
    Else
    btn.BackColor = _BaseColour
    btn.Size = New Size(CInt(rect.Height / 2), CInt(rect.Height / 2))
    btn.Location = New Point(rect.X + rect.Width - rect.Height + 11, CInt(rect.Y + 7))
    End If
    btn.Visible = ShowCloseButtonOnTabs
    btn.BringToFront()
    End If
    End If
    End Sub
    Protected Function CloseButtonOfTabPage(ByVal tp As TabPage) As Button
    Return (From item In CloseButtonCollection Where item.Value Is tp Select item.Key).FirstOrDefault
    End Function
    #End Region
    End Class
    This code shows a perfect tabcontrol as in the picture below,
    I managed to get this code working by combining three other VB themes I found. Right now, I just want to increase the width of the tab so the close button doesn't hides the text. And I want to add a icon to the left of the tab and be able to change it on
    runtime.
    The icons name will be on, off, 1, 2, plus .ico 
    Is it possible ? and is it possible to make the tabs curved at the corner like in chrome.

    Hi,
     I have went through your TabControl class and changed it around a little bit to get something similar to what i think you want.  I made it so that the Tabs are resized with the TabControl itself so that they always fill the width of the TabControl. 
    I also, made the Text of the tabs have its own rectangle which will automatically adjust it`s width according to weather or not the close buttons are shown so the text will never be under the buttons.
     As for the Icons, you could create another small class that inherits from the TabPage base class and add a public property to it for the Icon image.  You would have to use that class to add TabPages and set the Icon property.  Then in the
    TabControl class`s OnPaint overrides sub you would check if the Icon property of the TabPage is set and draw the image if it is.
     I didn`t go that far but, i used the TabPage`s Tag property for the Icon image.  Actually it is just an Image, not an Icon.  So, in the TabControl`s OnPaint overrides sub i check if the TabPage`s Tag property is set to an Image and if it
    is i adjust the Text rectangle to avoid the Image and draw the image.
     I moved the StringFormat to the OnPaint sub and set it to keep the text left aligned so it stayed next to the Image.  You can change it back to the Center if you want.  I also set the StringFormat trimming to EllipsisCharacter so it will
    cut the text off if it is to long to fit between the Image and the Close button.
     You can test it in a new form project first and to check out how it works and what i changed.
    Imports System.ComponentModel
    Imports System.Drawing.Drawing2D
    Imports System.Drawing.Text
    Public Class FSMTabControl
    Inherits TabControl
    #Region "Declarations"
    Private _TextColour As Color = Color.FromArgb(255, 255, 255)
    Private _BackTabColour As Color = Color.FromArgb(54, 54, 54)
    Private _BaseColour As Color = Color.FromArgb(35, 35, 35)
    Private _ActiveColour As Color = Color.FromArgb(47, 47, 47)
    Private _BorderColour As Color = Color.FromArgb(30, 30, 30)
    Private _UpLineColour As Color = Color.FromArgb(0, 160, 199)
    Private _HorizLineColour As Color = Color.FromArgb(23, 119, 151)
    #End Region
    #Region "Properties"
    <Category("Colours")> _
    Public Property BorderColour() As Color
    Get
    Return _BorderColour
    End Get
    Set(ByVal value As Color)
    _BorderColour = value
    End Set
    End Property
    <Category("Colours")> _
    Public Property UpLineColour() As Color
    Get
    Return _UpLineColour
    End Get
    Set(ByVal value As Color)
    _UpLineColour = value
    End Set
    End Property
    <Category("Colours")> _
    Public Property HorizontalLineColour() As Color
    Get
    Return _HorizLineColour
    End Get
    Set(ByVal value As Color)
    _HorizLineColour = value
    End Set
    End Property
    <Category("Colours")> _
    Public Property TextColour() As Color
    Get
    Return _TextColour
    End Get
    Set(ByVal value As Color)
    _TextColour = value
    End Set
    End Property
    <Category("Colours")> _
    Public Property BackTabColour() As Color
    Get
    Return _BackTabColour
    End Get
    Set(ByVal value As Color)
    _BackTabColour = value
    End Set
    End Property
    <Category("Colours")> _
    Public Property BaseColour() As Color
    Get
    Return _BaseColour
    End Get
    Set(ByVal value As Color)
    _BaseColour = value
    End Set
    End Property
    <Category("Colours")> _
    Public Property ActiveColour() As Color
    Get
    Return _ActiveColour
    End Get
    Set(ByVal value As Color)
    _ActiveColour = value
    End Set
    End Property
    Protected Overrides Sub CreateHandle()
    MyBase.CreateHandle()
    Alignment = TabAlignment.Bottom
    End Sub
    #End Region
    #Region "Draw Control"
    Sub New()
    SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer, True)
    DoubleBuffered = True
    Font = New Font("Segoe UI", 10)
    SizeMode = TabSizeMode.Fixed
    End Sub
    Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
    With e.Graphics
    .SmoothingMode = SmoothingMode.HighQuality
    .PixelOffsetMode = PixelOffsetMode.HighQuality
    .TextRenderingHint = TextRenderingHint.ClearTypeGridFit
    .Clear(_BaseColour)
    Try : SelectedTab.BackColor = _BackTabColour : Catch : End Try
    Try : SelectedTab.BorderStyle = BorderStyle.FixedSingle : Catch : End Try
    .DrawRectangle(New Pen(_BorderColour, 2), New Rectangle(0, 0, Width, Height))
    If Me.Created AndAlso Me.TabCount > 0 Then
    Dim tw As Integer = CInt(Me.ClientSize.Width / Me.TabCount)
    Dim offset As Integer = Me.TabCount
    If Me.ItemSize.Width <> tw - offset Then Me.ItemSize = New Size(tw - offset, 32)
    End If
    Using CenterSF As New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center, .Trimming = StringTrimming.EllipsisCharacter, .FormatFlags = StringFormatFlags.NoWrap}
    For i As Integer = 0 To TabCount - 1
    Dim Base As Rectangle = Me.GetTabRect(i)
    Dim txtrect As New Rectangle(Base.Left, Base.Top, Base.Width, Base.Height)
    Dim img As Image = Nothing
    If Me.TabPages(i).Tag IsNot Nothing Then
    txtrect.X += Base.Height
    txtrect.Width -= Base.Height
    img = DirectCast(Me.TabPages(i).Tag, Image)
    End If
    If ShowCloseButtonOnTabs Then
    txtrect.Width -= Base.Height
    End If
    If i = SelectedIndex Then
    .FillRectangle(New SolidBrush(_BaseColour), Base)
    .FillRectangle(New SolidBrush(_ActiveColour), New Rectangle(Base.X + 1, Base.Y - 3, Base.Width, Base.Height + 4))
    .DrawString(TabPages(i).Text, Font, New SolidBrush(_TextColour), txtrect, CenterSF)
    .DrawLine(New Pen(_HorizLineColour, 2), New Point(Base.X + 3, CInt(Base.Height / 2 + 2)), New Point(Base.X + 9, CInt(Base.Height / 2 + 2)))
    .DrawLine(New Pen(_UpLineColour, 2), New Point(Base.X + 3, Base.Y - 3), New Point(Base.X + 3, Base.Height + 5))
    Else
    .DrawString(TabPages(i).Text, Font, New SolidBrush(_TextColour), txtrect, CenterSF)
    End If
    If img IsNot Nothing Then
    .DrawImage(img, Base.Left + 2, Base.Top + 2, Base.Height - 4, Base.Height - 4)
    End If
    Next
    End Using
    .InterpolationMode = InterpolationMode.HighQualityBicubic
    End With
    End Sub
    Private Declare Auto Function SetParent Lib "user32" (ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As IntPtr
    Protected CloseButtonCollection As New Dictionary(Of Button, TabPage)
    Private _ShowCloseButtonOnTabs As Boolean = True
    <Browsable(True), DefaultValue(True), Category("Behavior"), Description("Indicates whether a close button should be shown on each TabPage")> _
    Public Property ShowCloseButtonOnTabs() As Boolean
    Get
    Return _ShowCloseButtonOnTabs
    End Get
    Set(ByVal value As Boolean)
    _ShowCloseButtonOnTabs = value
    For Each btn As Button In CloseButtonCollection.Keys
    btn.Visible = _ShowCloseButtonOnTabs
    Next
    RePositionCloseButtons()
    Me.Refresh()
    End Set
    End Property
    Protected Overrides Sub OnCreateControl()
    MyBase.OnCreateControl()
    RePositionCloseButtons()
    End Sub
    Protected Overrides Sub OnControlAdded(ByVal e As System.Windows.Forms.ControlEventArgs)
    MyBase.OnControlAdded(e)
    Dim tp As TabPage = DirectCast(e.Control, TabPage)
    Dim rect As Rectangle = Me.GetTabRect(Me.TabPages.IndexOf(tp))
    Dim btn As Button = AddCloseButton(tp)
    btn.Size = New Size(CInt(rect.Height / 2), CInt(rect.Height / 2))
    btn.Location = New Point(rect.X + rect.Width - rect.Height + 11, CInt(rect.Y + 7))
    SetParent(btn.Handle, Me.Handle)
    AddHandler btn.Click, AddressOf OnCloseButtonClick
    'ResizeTabs()
    CloseButtonCollection.Add(btn, tp)
    End Sub
    Protected Overrides Sub OnControlRemoved(ByVal e As System.Windows.Forms.ControlEventArgs)
    Dim btn As Button = CloseButtonOfTabPage(DirectCast(e.Control, TabPage))
    RemoveHandler btn.Click, AddressOf OnCloseButtonClick
    CloseButtonCollection.Remove(btn)
    SetParent(btn.Handle, Nothing)
    btn.Dispose()
    MyBase.OnControlRemoved(e)
    'ResizeTabs()
    End Sub
    Protected Overrides Sub OnLayout(ByVal levent As System.Windows.Forms.LayoutEventArgs)
    MyBase.OnLayout(levent)
    RePositionCloseButtons()
    End Sub
    Public Event CloseButtonClick As CancelEventHandler
    Protected Overridable Sub OnCloseButtonClick(ByVal sender As Object, ByVal e As EventArgs)
    If Not DesignMode Then
    Dim btn As Button = DirectCast(sender, Button)
    Dim tp As TabPage = CloseButtonCollection(btn)
    Dim ee As New CancelEventArgs
    RaiseEvent CloseButtonClick(sender, ee)
    If Not ee.Cancel Then
    Me.TabPages.Remove(tp)
    RePositionCloseButtons()
    End If
    End If
    End Sub
    Protected Overridable Function AddCloseButton(ByVal tp As TabPage) As Button
    Dim closeButton As New Button
    With closeButton
    '' TODO: Give a good visual appearance to the Close button, maybe by assigning images etc.
    '' Here I have not used images to keep things simple.
    .Text = "X"
    .FlatStyle = FlatStyle.Flat
    .BackColor = _BaseColour
    .ForeColor = Color.White
    .Font = New Font("Microsoft Sans Serif", 6, FontStyle.Bold)
    End With
    Return closeButton
    End Function
    Public Sub RePositionCloseButtons()
    For Each item As KeyValuePair(Of Button, TabPage) In CloseButtonCollection
    RePositionCloseButtons(item.Value)
    Next
    End Sub
    Public Sub RePositionCloseButtons(ByVal tp As TabPage)
    Dim btn As Button = CloseButtonOfTabPage(tp)
    If btn IsNot Nothing Then
    Dim tpIndex As Integer = Me.TabPages.IndexOf(tp)
    If tpIndex >= 0 Then
    Dim rect As Rectangle = Me.GetTabRect(tpIndex)
    If Me.SelectedTab Is tp Then
    btn.BackColor = Color.Red
    btn.Size = New Size(CInt(rect.Height / 2), CInt(rect.Height / 2))
    btn.Location = New Point(rect.Right - rect.Height + 11, CInt(rect.Y + 7))
    Else
    btn.BackColor = _BaseColour
    btn.Size = New Size(CInt(rect.Height / 2), CInt(rect.Height / 2))
    btn.Location = New Point(rect.Right - rect.Height + 11, CInt(rect.Y + 7))
    End If
    btn.Visible = ShowCloseButtonOnTabs
    btn.BringToFront()
    End If
    End If
    End Sub
    Protected Function CloseButtonOfTabPage(ByVal tp As TabPage) As Button
    Return (From item In CloseButtonCollection Where item.Value Is tp Select item.Key).FirstOrDefault
    End Function
    #End Region
    End Class
     In the Form`s code you can set the images for the TabPage icons like this.
    Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Me.TabPage1.Tag = Image.FromFile("C:\testfolder\img1.png")
    Me.TabPage2.Tag = Image.FromFile("C:\testfolder\img2.png")
    End Sub
    End Class
     Here is an example of what it looks like.
    If you say it can`t be done then i`ll try it
    Thanks :)) I tried you code and it works perfectly.
    Though i don't want the tabs have their width's by the size of form, so i fixed a width,
    If Me.Created AndAlso Me.TabCount > 0 Then
    'Dim tw As Integer = CInt(Me.ClientSize.Width / Me.TabCount)
    'Dim offset As Integer = Me.TabCount
    'If Me.ItemSize.Width <> tw - offset Then Me.ItemSize = New Size(tw - offset, 32)
    Me.ItemSize = New Size(200, 32)
    End If
    Here is the screenshot,
    I just don't know why the arrows (left and right) aren't full. here is a gif,
    Why is that :O Should I paint the arrows as well ?

  • How do i disable mouse button 4 and 5 to open new tabs or windows?

    Okay so I got myself a new mouse, its a logitech G700s mouse but I don't think that matters anyway.
    The problem is that the extra buttons on the mouse (small buttons on the side) i have are assigned as "mouse button 4" and "mouse button 5". Now to a standart mac system these buttons are assigned to open a new window or a new tab in safari but when I customly set these buttons to something else it does both of those things. For example i sat the mouse button 5 to mission control (show all windows) but now if I am using safari it also opens something in a new page if I am holding the cursor on a link.
    I just want to know how I can remove that function. To make the mouse button 5 and 4 do nothing.
    The system I use to customise the mouse buttons are a separate program. I need to know how to disable this new page function in the mac software.
    Sincerly Thomas.

    Okay so I got myself a new mouse, its a logitech G700s mouse but I don't think that matters anyway.
    The problem is that the extra buttons on the mouse (small buttons on the side) i have are assigned as "mouse button 4" and "mouse button 5". Now to a standart mac system these buttons are assigned to open a new window or a new tab in safari but when I customly set these buttons to something else it does both of those things. For example i sat the mouse button 5 to mission control (show all windows) but now if I am using safari it also opens something in a new page if I am holding the cursor on a link.
    I just want to know how I can remove that function. To make the mouse button 5 and 4 do nothing.
    The system I use to customise the mouse buttons are a separate program. I need to know how to disable this new page function in the mac software.
    Sincerly Thomas.

  • How can I separate the "Icons and Text" of the browser control buttons (Back, Forward, etc.) from the Icons on the Add-on toolbar?

    At home, this is not an issue. I don't know why it's different here at work--same installation, same settings (as far as I can tell).
    Windows Vista
    Firefox 7.0.1
    Status-4-Evar installed to turn add-on bar into a status bar
    I have a NoScript add-on icon in the corner, which works fine. If I add a GreaseMonkey icon from the Customize menu, the "Icon and Text" appears for that icon, like the Icon and Text from the browser controls (Home, stop, etc). Other add-on icons also show Icon and Text (S4E, for instance). NoScript is the only one I've found so far which collapses down to just an Icon.
    This leads to the status (add-on) bar having a much larger height than I like. Essentially what I want is for only the Icon to appear in the Status bar (Add-on toolbar), while keeping Icons and Text in the Browser controls. My current workaround is simply removing the other add-on icons from the status (add-on) toolbar, but that takes away the ease of toggling and setting options.
    Please tell me if I can provide you with anything else, and thanks for your help.
    Edit: I've got some screenshots to show what I mean.
    [http://i41.tinypic.com/ftek9s.jpg desired behavior]
    [http://i43.tinypic.com/1z6a4h3.jpg problem when icon is added]

    Surely there must be some UserChrome.css that will solve this problem. Something like this:
    /* Remove text titles for icons in add-on bar */
    addonbar .button-text {
    visibility: collapse !important;
    Unfortunately that does not work. I probably have the button text item name wrong (there is a pound sign before addonbar but it doesn't show in this posting).

  • How can I make appear the arrow-button that showed the recent history of a same tab (next to back and forward buttons)?

    for instance, if I searched a word on google, then clicked on a certain page of the results, then inside that page I entered a link, etc if I wanted to "go back" directly to the instance of google searching I could click on this arrow-button and I would be able to choose that exact moment instead of clicking several times on the "back" till I reached the desired past page

    The arrow to open the tab history of the Back and Forward buttons has been removed in Firefox 4 and later.
    Use one of these methods to open the tab history list:
    * Right click on the Back or Forward button
    * Hold down the left mouse button on the enabled Back or Forward button until the list opens
    You can look at this extension:
    * Backward Forward History Dropdown: https://addons.mozilla.org/firefox/addon/backforedrop/

Maybe you are looking for

  • Can't read or write from Raid

    Hi all, I'm new to the Xserve RAID world, and I'm hoping someone out there can help. We've been using the RAID with one computer for about 4 or 5 months now and it has worked great. We finally got all the equipment in to connect it to the other two m

  • Unable to install xp-unable to accept EULA cos trackpad/keyboard stops work

    Trying to install xp on 10.6.2 on macbook pro 13.3" 2009 model using bootcamp 3.0. The partitioning and windows setup went fine, but during installation, Windows asks me to accept EULA before installing but my trackpad and key board stopped working a

  • Installed Snow Leopard now my Mac wont power up

    I have a Mac mini 1.66 it's three years old. Before installing Snow Leopard I haven't had any problems. After installing it my mac won't start. It shows no sign of power even though it's plugged in. Any suggestions?? Was it just it's time and it happ

  • IFCU  - How to enter the readings ?

    HI dears,          I am trying to use fleet management         I had customized the settings for fleet management        When i entering into IFCU  i am not able to enter the consumed quantity as it is in a display mode. No measurings points found ev

  • Dashboard content is not populated with Planned Cost and Actual Cost

    Hi We are working in cProjects 4.0 + ECC 6.0 implementation. I could not get the data for columns in Planned Cost and Actual Cost in cProjects Project Dashboard. I have properly mapped the config settings and created and assigned a Project in PS Has