How do i set the background of the table( not of cell / row / column).

How do i set the background of the table( not of cell / row / column).
What happens when i load the applet the table is blank and displays the background color is gray which we want to be white.
We tried using the setBackGround but it is not working maybe we are not using it properly. Any help would be gr8.
Thanks in advance.

I don't understand very well, but i guess that the background is gray when the table content's empty, isn't it?
When the table model is empty, the JTable doesn't paint, so its container displays its background (often gray).
In this case, what you must do is force the table to paint, even if the model is empty. So, you have to create your own table and override three methods :
public class MyTable extends JTable
//specify the preferred and minum size when empty
myPreferredWidth = 200;
myPreferredHeigth =200;
myMinimunWidth = ...;
myMinimunHeigth = ...;
public Dimension getPreferredSize()
if(getModel().getRowCount() < 1)
return new Dimension(myPreferredWidth, myPreferredHeigth);
else
return super.getPreferredSize();
public Dimension getMinimumSize()
if( getModel().getRowCount() > 0)
return new Dimension(myMinimunWidth, myMinimunHeigth);
else
return super.getMinimumSize();
protected void paintComponent(Graphics g)
if (getModel().getRowCount<1 && isOpaque()) { //paint background
g.setColor(Color.white);
g.fillRect(0, 0, getWidth(), getHeight());
else super.paintComponent(g);
}

Similar Messages

  • How do i set a background of the button as an image??

    hey guys... i was wondering if there is a way i could change the background of spark button component to an image??
    ive looked into the icon property of the spark button, but thats not what i need... i need the entire background of an image to be an image...
    any ideas??
    thanks in advance!!!

    Something like this: http://blog.flexexamples.com/2010/04/29/setting-a-bitmap-fill-on-a-spark-button-control-in -flex-4/
    Peter

  • In Pages, how can I set a background for the whole document?

    I tend to regard Pages as more of a page layout program than a simple word processor, so I use it for stuff containing graphics as well as text. Now I want to put a kind of frame around every page in the document, and I want this frame to be effectively a background for everything else, with it being my responsibility for the remainder of the material to stay in the frame. I can't see any feature that allows this apart from Headers and Footers, and as far as I can see, these are not supposed to occupy the whole page, just the top and bottom.
    Can anyone give a good technique for configuring a background in this way?
    TIA

    This forum has helped me to partially answer my own question, in that I see now that I want to create a template with a section master that contains my graphic. But when I tried to do this, the menus for making a graphic (in my case a grouped item) part of a section master just didn't work. I am trying to follow the Help page "Using Master Objects (Repeated Background Images), but so far I can't get the menus to undim.
    Can anyone help?

  • How do I set the stage (or the background in the stage?) to be transparent?

    How do I set the stage (or the background in the stage?) to be transparent?
    Thanks
    Gary

    Select Stage.
    Color Swatch
    Then set the Alpha slider to 0.
    Darrell

  • How do you set a image in the background of a JTextfield?

    How do you set a image in the background of a JTextfield? Any ideas?

    You can't thats why it is called textfield!!!
    Take a look at JScrollPane API for this

  • How do you set an image into the background of a JPanel or JFrame?

    How do you set an image into the background of a JPanel or JFrame?

    Something like this, Ive thrown in an ImageIcon on a
    button too for good measure.
    import java.awt.*;
    import javax.swing.*;
    public class JFrameImage extends JFrame {
    public JFrameImage() {
    Container c    = getContentPane();
    JPanel panel = new JPanel(){
                 public void paintComponent(Graphics g)     {
    ImageIcon img = new
    = new ImageIcon("background.jpg");
                      g.drawImage(img.getImage(), 0, 0, null);
                      super.paintComponent(g);
            panel.setOpaque(false);
    ImageIcon icon = new ImageIcon("onButton.jpg");
    JButton button = new JButton(icon);
    panel.add(button);
    c.add(panel);
    public static void main(String[] args) {
    JFrameImage frame = new JFrameImage();
    frame.setSize(200,200);
    frame.setVisible(true);
    Going totally fancy pants
    ImageIcon bigImage = new ImageIcon(bgImage.getImage().getScaledInstance(getWidth(), getHeight(),Image.SCALE_REPLICATE));
    g.drawImage(bigImage.getImage(), 0, 0, this); Will scale the image to the size of the panel
    whereas
    for (int y = 0; y  < getHeight(); y = y + image.getHeight(null))
    for (int x = 0; x< getWidth(); x = x + image.getWidth(null))
    g.drawImage(image, x, y, this); Will give a tiled effect
    Try tiling with an animated gif and bring your processor to a standstill.

  • How do I set the background on the Secondary Desktop?

    I just upgraded to Snow Leopard 10.6.8 and connected a Secondary display.  Computer is a Quad-core Mac Pro.   I have a 27" Cinema display as the primary, the secondary is a 22" DVI monitor connected to the second Mini DisplayPort using an Apple adapter.
    The problem is that I can not set the Secondary Desktop.  It defaults to "Aurora" and refuses to budge.
    If I go to System Preferences > Desktop & Screen Saver, a window titled "Secondary Desktop" opens up on the secondary display, but no matter what selection I make the background on the secondary display does not change.
    Same results (Secondary desktop does not change) if I right click the secodary display and select "Change Desktop Background".
    This is not a complicated setup; no TV, no MacBook Pro used as a monitor, etc., just a Mac Pro with two monitors.
    It seems like this should be easier. 

    Does this Graphics/Displays report from System Profiler look correct?
    I'm surprised that the Connection type for the secondary monitor is not
    showing up.
    ATI Radeon HD 5770:
      Chipset Model:          ATI Radeon HD 5770
      Type:          GPU
      Bus:          PCIe
      Slot:          Slot-1
      PCIe Lane Width:          x16
      VRAM (Total):          1024 MB
      Vendor:          ATI (0x1002)
      Device ID:          0x68b8
      Revision ID:          0x0000
      ROM Revision:          113-C0160C-155
      EFI Driver Version:          01.00.436
      Displays:
    LED Cinema Display:
      Resolution:          2560 x 1440
      Pixel Depth:          32-Bit Color (ARGB8888)
      Display Serial Number:          2A0383V36JL
      Main Display:          Yes
      Mirror:          Off
      Online:          Yes
      Rotation:          Supported
      Connection Type:          DisplayPort
    AL2223W:
      Resolution:          1680 x 1050 @ 60 Hz
      Pixel Depth:          32-Bit Color (ARGB8888)
      Display Serial Number:          L840B0183922
      Mirror:          Off
      Online:          Yes
      Rotation:          Supported
    Display Connector:
      Status:          No Display Connected

  • How do I set a variable on the main timeline from within a symbol?

    Just getting started with Animate and coming to it from Flash, as may be apparent from my question. How do you set a variable to the main timeline from within a symbol?
    I have 24 pairs of clickable elements, each in their own symbols, and all 24 of those symbols sit inside another symbol. I want all 24 to be able to set the same global variable when clicked. I can't find that this question is addressed anywhere, which makes me think I may be stuck in a Flash mindset and approaching the task in the wrong way. (There are however MANY discussions of how to address objects at different levels in the hierarchy. That's well covered.)
    Relatedly, how do you access a function on the main timeline from within a symbol?
    Adobe should consider putting together a support page (or pages) just for folks migrating form Flash. In the materials I've encountered so far there seems to be a studied effort to refrain from mentioning Flash in any way. I imagine there are a lot of people out there like me who have a deep background in Flash coding, but are just getting started with Animate. We don't need help with most of the basic concepts, but we may still have some pretty basic questions about how to accomplish some things in Animate because our Flash knowledge is getting in the way.

    Hi Bill,
    There are plenty of threads on here about scope, but here's one way to create a global variable:
    // code on Stage.compositionReady
    sym.myGlobalVar = 1;
    Then, anywhere in your project, you can check/set that var like so:
    sym.getComposition().getStage().myGlobalVar = 2;
    And here's one way to create a global function:
    // code on Stage.compositionReady
    sym.myGlobalFunction = function(){
              console.log('myGlobalFunction');
    Then, anywhere in your project, you can call that function like so:
    sym.getComposition().getStage().myGlobalFunction();

  • How to turn off programs running in the background in the background on iPad

    how to turn off programs running in the background in the background on iPad

    Most apps do not run in the background on an iPad. Their stae is kept in memory so that when you start the app again it will load quickly at the location you last used it. But you can remove these apps from the Recently Used list. Here's how:
    Double click the Home button to show the screen with running and recently used apps. Each app icon will have a sample page above it. Flick up on the page (not the app icon) and the page will fly away and the app icon will disappear. This quits that app.
    Some apps do refresh in the background if you have that Setting turned on. You can control apps there individually or turn off Back Ground App Refresh completely in the Settings App.
    Settings > General > Background App Refresh

  • When sharing an email the background like corkboard is not there- just black background shows. How do I fix this?

    When sharing an email the background like corkboard is not there- just black background shows. How do I fix this?

    Check, if the backgrounds are installed correctly in the system library.
    Compare with your other two apples
    The corkboard pattern and other backgrounds should be found in
    /Library/Application Support/iPhoto/Themes/Shared/Backgrounds/
    /Library/Application Support/iPhoto/Themes/Assets/Email/
    /Library/Application Support/iPhoto/Themes/Assets/Shared/Backgrounds/Cork/corktile.jpg
    To quickly open these folders select the complete line above, ctrl-click it (or right-click) and select "Services" from the pop-up menu. Then select "Open".
    Inspect the folder that opens and compare with your other mac, if all files are there and if the permissions are set correctly. Restore from your other mac, if necessary or reinstall iPhoto to restore.
    If all folders are there and missing theme files are not the problem, post back.
    Regards
    Léonie

  • How do I set a reminder for the last day of every month

    Have I missed something? But how do you set a reminder for the last day of every month to recurr indefinatley in iOS6? Sorry if this is really simple but I just can't seem to work it out. Any help gratefully received.

    Hey Mattye88 not sure if you have seen but actully you can do this, but for some reason you have to use Siri.  If you bring up Siri and say "set a reminder ever 4 weeks from next wednesday to check the gas meter" it will set one and it will work just fine, I have reminders to water a Bonsai every three days and it works fine it just shows as custom repeat on the user interface.  Alas it seems you can not use Siri to set one for the end of the month though which is why I am in this threed.  Still hope it helps you to know how to sort this problem atleast.

  • I need to know how to edit a drawing - basically remove the arrows and text but at the same time match the background of the existing pic. then re add new text. how do i erase the arrows and text and arrows but match current background of pic. step by ste

    i need to know how to edit a drawing - basically remove the arrows and text but at the same time match the background of the existing pic. then re add new text. how do i erase the arrows and text and arrows but match current background of pic. step by step explanation please beginner

    Please post (a relevant section of) it right on this Forum.

  • How do i turn off apps running in the background with the new upgrade?

    how do i turn off apps running in the background with the new upgrade?

    They changed it a bit, but you can still close apps. Double click the Home button to pull up the currently running apps. Side scroll over to the app you want to close, then swipe up on the app *window* (not the icon at the bottom).
    = L.I.

  • How to change the background and font color of a particular row in table

    Hi,
       i need to change the background and font color of a particular row. I am using textview as table columns. I tried to do it using semanticColor property of textview  but the font color get changed for the whole column. But i want to change the color of a particular row only.
       If anybody knows please help me(give an example if possible).
           Thanks and regards.
            Pankaj Kumar.

    Hi Pankaj,
    In your data source context node (context node which is bound to dataSource property of Table UI elemennt) do following:
    If data source node is model node: create a value node under data source node, cardinality 1..1, selection 1..1, singleton false. In this new node add value attribute and set property readOnly=true, calculated=true, property com.sap.ide.webdynpro.uielementdefinitions.TextViewSemanticColor .
    If datasource node is value add value attribute and set property readOnly=true, calculated=true, property com.sap.ide.webdynpro.uielementdefinitions.TextViewSemanticColor.
    In calculated getter method put your color calculation depending on conditions, like:
    return <condition>
      ? WDTextViewSemanticColor.CRITICAL
      : WDTextViewSemanticColor.STANDARD;
    Bind new created attribute with property semanticColor of textview.
    Best regards, Maksim Rashchynski.

  • How do I change the background in the Menu bar screen area so that it is lighter and thus more readable?

    The background in the area where the Menu bar now sits is jetblack.. When I drag, say, the print icon or cut, paste, save icons to sit to the right of the menu bar, they're there but either I see them only faintly (printer) or I cna't see them only faintly. How can I change the background to a lighter color (it used to be much lighter).

    The easiest way might be to install a lightweight theme (formerly known as a persona). You can "shop" for one on the Add-ons site. The following link is for solid colors, but some of the pictorial ones might work, too.
    https://addons.mozilla.org/en-US/firefox/themes/solid
    You can hover your mouse over the little image tile to see how it would look if you installed it. Can you find one that looks good to you?
    Much of Firefox's interface also can be modified with style rules. However, that requires a lot more experimentation, so let's come back to that only if needed.

Maybe you are looking for

  • Dunning letter via email with invoice attachments

    Hi Experts, We have requirement where in dunning letter should be send to customer via email along with invoice attachments. We have copied standard script F150_DUNN_02 to custom one as per requirements and configured it in SPRO. We are using BTE 104

  • 24" iMac freezing occasionally/Please Help

    24" iMac freezing occasionally without allowing force quit. Sometimes when I attempt to restart it, when the computer comes back on it will freeze on a gray screen with a folder in the middle with a question mark on it. If I unplug all peripherals an

  • Need photo album/gallery with upload/download capabilities

    Hi all, This is my first time here. I've recently purchased my first Mac with iLife and have Dreamweaver MX. I'd like a photo album app that allows for easy uploading of images (batch if possible). I'd like to take the images and make quicktime movie

  • HT1918 how to cancel my purchased so i can change my country Reagent ?

    i need to cancel my purchased so i can change my country Reagent

  • Payment card settlement FCC1

    Hi All, We have an urgent business requirement - Appreciate for an favourable response and help on this. In our current system setting for payment card There are two different A/R  G/L account   one is 124040 and 124035 which has been assigned with C