Drawing a lowered / raised bevel border around column headers

Hello,
I have a JTable and I want that every time while the user is pressing the mouse button down on one of the column headers, it will be drawn with a lowered bevel border around it, and with a raised border while it is not pressed. The problem is that the renderer of the headers has no way of knowing the state of the mouse button when it is requested to draw itself...
Does anyone know how I can accomplish this effect?
Thanks.

Create your own renderer which has a field to indicate which one of the columns to draw with a lowered bevel border around it. (column number is passed into getTableCellRendererComponent, so you know which column is being rendered)
Add a mouse listener to the header which tells the renderer which column has been clicked on.
The cell renderer also needs to implement TableColumnModelListener, so that the depressed column index tracks re-ordering of the columns.
Pete

Similar Messages

  • How to draw a border around shape objects?

    How would I draw a border around something like an Ellipse2D object? I tried using using a BasicStroke in a sub-class of Ellipse but nothing showed.

    nvm, figured it out, I wasn't calling the draw method :)

  • How to draw a border around a Textured Plane?

    Hi everyone,
    How does one go about drawing a square border around a textured square plane?
    I've tried using the setBoundaryColor() method, and have set the texture2D's boundaryModeS and boundaryModeT to CLAMP, but no boundary color appears.
    Can someone help?
    Here are some fragments of my code:
    /** My plane **/
    QuadArray plane = new QuadArray(20, GeometryArray.COORDINATES
    | GeometryArray.TEXTURE_COORDINATE_2
    | GeometryArray.COLOR_3
              float length = 0.5f;
              float epsilon = 0.1f;
         Point3f p = new Point3f(-length/2.0f, length/2.0f, 0.0f);
    plane.setCoordinate(0, p);
    p.set(-length/2.0f, -length/2.0f, 0.0f);
    plane.setCoordinate(1, p);
    p.set(length/2.0f, -length/2.0f, 0.0f);
    plane.setCoordinate(2, p);
    p.set(length/2.0f, length/2.0f, 0.0f);
    plane.setCoordinate(3, p);
         Point3f upperborder = new Point3f(-(length/2.0f+epsilon), length/2.0f+epsilon, 0.0f);
    plane.setCoordinate(4, upperborder);
    upperborder.set(-(length/2.0f+epsilon), length/2.0f, 0.0f);
    plane.setCoordinate(5, upperborder);
    upperborder.set((length/2.0f), length/2.0f, 0.0f);
    plane.setCoordinate(6, upperborder);
    upperborder.set((length/2.0f), length/2.0f+epsilon, 0.0f);
    plane.setCoordinate(7, upperborder);
    Point3f rightborder = new Point3f((length/2.0f), length/2.0f+epsilon, 0.0f);
    plane.setCoordinate(8, rightborder);
    rightborder.set((length/2.0f), -(length/2.0f), 0.0f);
    plane.setCoordinate(9, rightborder);
    rightborder.set((length/2.0f+epsilon), -(length/2.0f), 0.0f);
    plane.setCoordinate(10, rightborder);
    rightborder.set((length/2.0f+epsilon), length/2.0f+epsilon, 0.0f);
    plane.setCoordinate(11, rightborder);
    Point3f lowerborder = new Point3f(-(length/2.0f), -length/2.0f, 0.0f);
    plane.setCoordinate(12, lowerborder);
    lowerborder.set(-(length/2.0f), -(length/2.0f+epsilon), 0.0f);
    plane.setCoordinate(13, lowerborder);
    lowerborder.set((length/2.0f+epsilon), -(length/2.0f+epsilon), 0.0f);
    plane.setCoordinate(14, lowerborder);
    lowerborder.set((length/2.0f+epsilon), -length/2.0f, 0.0f);
    plane.setCoordinate(15, lowerborder);
    Point3f leftborder = new Point3f(-(length/2.0f+epsilon), length/2.0f, 0.0f);
    plane.setCoordinate(16, leftborder);
    leftborder.set(-(length/2.0f+epsilon), -(length/2.0f+epsilon), 0.0f);
    plane.setCoordinate(17, leftborder);
    leftborder.set(-(length/2.0f), -(length/2.0f+epsilon), 0.0f);
    plane.setCoordinate(18, leftborder);
    leftborder.set(-(length/2.0f), length/2.0f, 0.0f);
    plane.setCoordinate(19, leftborder);
    TexCoord2f q = new TexCoord2f(0.0f, 1.0f);
    plane.setTextureCoordinate(0, 0, q);
    q.set(0.0f, 0.0f);
    plane.setTextureCoordinate(0, 1, q);
    q.set(1.0f, 0.0f);
    plane.setTextureCoordinate(0, 2, q);
    q.set(1.0f, 1.0f);
    plane.setTextureCoordinate(0, 3, q);
    /** My Texture (using Appearance) **/
    // can't use parameterless constuctor
    Texture2D texture = new Texture2D(Texture.BASE_LEVEL, Texture.RGBA, image.getWidth(), image.getHeight());
    texture.setImage(0, image);
    texture.setEnable(true);
    texture.setMagFilter(Texture.NICEST);
    texture.setBoundaryModeS(Texture.CLAMP_TO_BOUNDARY);
    texture.setBoundaryModeT(Texture.CLAMP_TO_BOUNDARY);
    texture.setBoundaryColor(new Color4f(1.0f, 0.0f, 0.0f, 0.0f));
    planeAppearance.setTexture(texture);
    Is there a better way to do it?
    Thanks in advance for any help!

    Do a control-A (select all). This should put a selection outline around your image. Then do an Edit-Stroke. Define your Width in pixels, Color, and then choose Inside. Set blending to whatever you want (Normal for a solid color) and then the Opacity.
    Play with it. Have fun. Do NOT edit original images - always do an Image-Duplicate before doing edits until you know what you're doing. It is way too easy to make edits and then save that file over your original - losing the source file forever (unless you have a backup).

  • Draw a thin border around an inputText box????

    Hi,
    I would like to draw a thin border around an inputText box but when I use the following, I am getting a thin border around the inputText box as well as the label (text) associated with it. I don’t really want this border around the label.
    border-width:thin; border-style:solid
    So how can I draw a thin border just around a inputText box only (Not around the label associated with the inputText) ?
    Regards
    V.Piraba

    Hi
    I found the answer. Just do the following to draw a thin border around a inputText box.
    border-width:thin; border-color:rgb(0,0,0)
    ---------------------------------------------

  • Border around cells

    Hi all!
    I have looked at the DefaultTableCellRenderer. This draws a border around one cell. Is it possible to draw a border around several cells, so that they form a "block of cells".
    Johan

    jtable painting is done cell by cell. To get border around few blocks you need to use your own UI class.Please look into BasicTableUI.java , there you'll find paintRow( ) method that'll delegate the call to paintCell for each cell painting. override paintRow to paint border around few cells after the paintCell operation for all the columns in that row is completed. This can be done by getting getCellRect for the required columns and adding to get a bigger rectangle and painting that rectangle.

  • Border around jpanel

    hi all,
    can you use a border around a jpanel like bevel border or raised border
    thanks

    Well, you don't want to use the 'dontSetBorder' method. Yes, use the setBorder method along with BorderFactory. If you want to set the border of a jpanel, you might wanna look at the jpanel in the api. setBorder comes from a parent of jpanel, component or something, so look there.

  • How do I print multiple (4) photos on one page with a border around each?

    How do I print multiple photos on one page with a border around each? I've gone the contact sheet route and adjusted the number of columns but there's only outer margins and very little white space between the photos down the middle of the page.

    Ok, now I feel stupid! I always thought I was printing 6 x 4 but now I realise I can't have done!!
    The photos that I used to print are approx. 5.2" x 4" (i.e. 4 fitted nicely on a page & I had to cut the boarder off).
    I guess I just need to play with different sizes under the 'custom' option in order to get the biggest possible picture!
    Thanks for the help

  • How to get rid of the black border around the artboard

    Hopefully my last question for tonight.
    I need to get rid of the black border around the artboard. The two images show my drawing lined up with the art board and then inside the artboard. The dark gray is not the artboard.
    As you see, the artboard has a black border. I need to get rid of it. It shows up in my project when my color key is green. The black won't go to transparent.
    So how-to get rid of the border? Thanks
    ***Update***
    I figured it out. View > Hide Artboards. Maybe this will help someone. Doesn't change the fact my spider looks like a tick:)

    Doesn't change the fact my spider looks like a tick:)
    Try to get hold of a real spider and take a look at its anatomy, specially where the legs sprout from :-)

  • How to create a border around JCheckBox?

    Hello,
    I would like to set a border around a JCheckBox. I don't mean the little square arround the check symbol, I mean the whole component. Does anyone know how to do this?
    More details:
    What I am trying to do is to use a JCheckBox as the renderer for a column in a JTable. However, I would like the values of this column to look like the column headers. In other words, I am trying to create a "row header". However, when I try to set the border of my JCheckBox to the same thing as the header renderer component, it doesn't show up that way. If I just use a JLabel as the renderer, I can set the border and it shows.
    Does anyone have a suggestion? Thank you for your help.

    yourCheckBox.setBorderPainted(true);

  • I just bought a C4680 all-in-one new in box. It puts an irregular border around "borderless" prints

    I just bought a C4680 all-in-one new in box.  It puts an irregular border around "borderless" prints (at least in 8.5 x ll size) --border is about 1 inch on right, 3/4 at top, 3/8 at bottom and 3/16 at left.  How do I eliminate this?
      Using win XP.

    In iTunes on your computer, select the Purchased section under STORE in the left column. Click on the first track and choose "Get Info" from the "File" menu.
    In the "Summary" tab you'll see details of the purchaser of the track. Click Next to go through all your purchased music one by one until you find the ones you need to get rid of.
    Unfortunately, there are no smart playlist rules that can filter tracks by the purchaser that I know of.

  • Changing thickness of border around fields

    Hi
    Is it possible to change the thickness of the border around a database field/ text box etc? I can only find an option to choose the type of border (Single, Dotted, Dashed etc), but not the thickness.
    The field that I use in the report has the Can Grow property set to True as well.
    I use CR 2008.
    Thanks

    Hi
    @V361-V361
    No, I cannot control the size of the text. So I guess there is no work around to this problem...
    @wickedweapon
    I have just started using Crystal Reports. But it is possible to write formulae (Basic Syntax) to select the type of border.
    If {Table.ColumnName} > value Then
          crDoubleLIne
    Else
          crSingleLine
    End If
    If you write the above code in the top margin section, then the border changes depending on the column value.
    Hope this has helps...
    Tanya

  • Iphone quartz border around line

    Hello,
    what's the best way to draw a (solid black) border around a line in quartz for iphone? I'm drawing lines on streets on a map and if the line is yellow (which is a legit use case), it blends in with the street color. One thing I could do is lay my lines over a little thicker black line, but this doesn't sound very efficient.

    Why not draw the path that you're using with a black fill and a slightly wider line-width (even 0.1 units wider), and then draw the street line on top of that?

  • Create border around Grid/GridItem

    Hi,
    I am stuck with a problem and no idea on how to proceed on this.
    I have created a Grid and want to draw border around it so its appearance is like table. The borders are just not appearing. Can someone provide any direction what I may be missing.
    Here is the code
    [PHP]
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
        <mx:Style>
            Grid
                horizontal-gap:-1;
                vertical-gap:-1;
                border-color:#000000;
                border-style:solid;
                border-thickness:5;
            GridItem
                border-color:#000000;
                border-style:solid;
                border-thickness:5;
        </mx:Style>
        <mx:Grid x="31" y="24">
            <mx:GridRow>
                <mx:GridItem width="100" height="30">
                    <mx:Label text ="Nitin">
                    </mx:Label>
                </mx:GridItem>
                <mx:GridItem width="100" height="30">
                    <mx:Label text ="Nitin">
                    </mx:Label>
                </mx:GridItem>
                <mx:GridItem width="100" colSpan="2" height="30">
                    <mx:Label text ="Nitin">
                    </mx:Label>
                </mx:GridItem>
            </mx:GridRow>
            <mx:GridRow>
                <mx:GridItem width="100" height="30">
                    <mx:Label text ="Nitin">
                    </mx:Label>
                </mx:GridItem>
                <mx:GridItem width="120" colSpan="2" height="30">
                    <mx:Label text ="Nitin">
                    </mx:Label>
                </mx:GridItem>
                <mx:GridItem width="100" colSpan="3" height="11">
                    <mx:Label text ="Nitin">
                    </mx:Label>
                </mx:GridItem>
            </mx:GridRow>
            <mx:GridRow>
                <mx:GridItem width="100" height="30">
                    <mx:Label text ="Nitin">
                    </mx:Label>
                </mx:GridItem>
                <mx:GridItem width="100" height="30">
                    <mx:Label text ="Nitin">
                    </mx:Label>
                </mx:GridItem>
                <mx:GridItem width="120" colSpan="3" height="30">
                    <mx:Label text ="Nitin">
                    </mx:Label>
                </mx:GridItem>
            </mx:GridRow>
        </mx:Grid>
    </mx:Application>
    [/PHP]

    I even tried using the graphics to create border but it is not working
    private var bgColor:uint 
    = 0x000000;
    private var borderColor:uint  = 0x666666;
    private var borderSize:uint   = 2;
    private var cornerRadius:uint = 0;
    var grid:Grid = new Grid();
    grid.graphics.beginFill(bgColor);
    grid.graphics.lineStyle(borderSize, borderColor);
    grid.graphics.drawRoundRect(0, 0, grid.width, grid.height, cornerRadius);
    grid.graphics.endFill();

  • Export from FCE to iDVD, results in black border around movie

    Here is the problem....
    I have edited a movie in FCE where all of the footage is 1440 x 1080
    I export it using: File -> Export... QuickTime movie
    I choose "self contained" movie and "audio/video", plus "chapter markers" in the pop up menu.
    I then take this into iDVD amd all looks ok in the preview, but once burnt to DVD, there is a large black border around the entire movie.  It is almost like it is a smaller movie which does not fill the screen correctly.
    Any idea why this happens and how to overcome this. When I lok at the exported movie from FCE- it is 720-x576 and not the full size- is this the problem?
    Thanks for any tips.

    Hi
    Is it widescreen ?
    Did You in Your browser window set sequence and material to anamorphous. To me it was a revelation that the Browser window was exstendably to the right with lot's of columns - and one of them was Anamorphous.
    Did you start a WideScreen project in iDVD - First window that opens after You clicked Start a New iDVD project (top button). At bottom this new window You set 4:3 (SD format) or 16:9 for WideScreen.
    In iDVD You also need to go up to Project and down to Projectinfo
    then set 16:9 here TOOO !
    Proportion - Change it to 16:9
    When I go from FinalCut to iDVD - I do
    FCE/P to iDVD
    Several things
    • How to go from FCE/P to iDVD
    • Free space on Start-up hard disk
    • Encoding
    • Brand and type of DVDs used
    • Burn speed set
    • iDVD BUG
    • Chapters
    How to go from FCE/P to iDVD I do
    • Disable Screen and Energy saver
    • IMPORTANT --> FIRST in FinalCut - Mix Down Audio under Sequence Menu / Render Only / Mix-down
    • Export out as a QuickTime .mov file
    • Select with Mark - Chapter Mark
    • Not as Self-Contained (not important but saves time and space)
    • NO QUICKTIME CONVERSION (IMPORTANT)
    This QT.mov file I import into iDVD from within iDVD.
    Free space on Start-up hard disk
    I set a minimum of 25GB (for Mac OS and iDVDs temp files)
    Encoding
    • I use Pro Quality encoding
    Brand and type of DVDs used ( Important as cheap brands DO NOT WORK )
    • I use Verbatim
    • I use DVD-R
    Burn speed set (IMPORTANT)
    • I set down this to x4 (or x1)
    iDVD BUG
    • One can not go back to movie-project for any alterations and then go back to
    the iDVD project. It will notice and ask You to either Up-date or Cancel. Neither
    of them will work.
    Medicine - Start a brand new iDVD project.
    Use of Chapters
    • I only use a to z and 0 to 9 in naming them. NO other symbol/letter !
    • NO Chapter-mark at very beginning - iDVD NEEDS TO set this by it self
    • No Chapter marks in or within two seconds from a transition
    (Way around this last one - Export movie as QT full quality and NO Chapter marks
    Import this into a new Movie-project and now You are free to set C-Ms where You want
    them except at very beginning - still)
    Material used to build movie
    • video - I use streamingDV (or convert all other to this e.g. .mp4, .avi, .wmv etc)
    • audio - I use .aiff 16-bit 48kHz or from Audio-CD (44.1kHz) - no .mp3 or direct from iTunes
    • photos - I use .jpg - no .bmp etc
    Problems - then Trash iDVD pref. file and run Repair Permissions - and have a re-try.
    from post ??
    May not be relevant, but I had the same problem with iDVD, where burned DVDs showed a green screen. It was cured by quitting Quicksilver and Quickeys as well as disabling sleep and screen-saving
    Yours Bengt W

  • Border around Label?

    Hi all!
    How to I draw a border around a label?
    I appreciate your support and insight!
    Best regards,
    -Tony

    You could make a re-usable simple MXML component.

Maybe you are looking for

  • How to paginate the Report output spanning multiple pages

    Hello, We have a Report that has a custom Layout and it shows invoice information. Our system has to generate an Invoice per day. This Report is printed fine for single day. But our users have 2 requests: 1. To print all the invoices for 1 month 2. T

  • Officejet Pro 8600 Plus says ink is empty when it is not

    Each time I have to change one cartridge on the Officejet Pro 8600 Plus I check how full the other cartridges are.  Typically the yellow one is 75% full and the other colours about 50%.  So I buy and install one cartridge.  It doesn't matter if it is

  • How do I view incoming call telephone numbers from Verizon web site?

    I am trying to view incoming call numbers from the Verizon web site on my account.  I can do this on my past staements but need to see the incoming call numbers between the last statement and current (today)?  Can anyone help me?

  • Navigation on Date - Format

    Hi Experts, I have a requirement as follows: On One page/tab(Tab1), I display the dates for which I have my data. On Click of a specific date, it should take me to a different tab(Tab2) passing the selected date value as prompt to Tab2. I have implem

  • Data Manager  (standalone)

    Oracle 8 : How to use Data Manager (Enterprise Manager) without having a Management Server (standalone)