Components Not Showing In JPanel

I am trying to make a program that I can give to friends and family to help them keep track of their banking accounts and the such (It's nothing big I'm making, just something to do in my spare time). I've coded all the data classes and such (Transaction, Account, Type, etc) and am now working on the GUI. I've made them before so I created this bit of code. The problem is, whenever I run the program, I only get the frame and JMenuBar. The rest is white space where my JPanel should be. The panel is there, I've tried setting the background color to black and the entire frame follows suit accordingly, but all the objects I've added aren't there? I know I'm missing something painfully obvious, so if anyone out there would help out I would be much obliged.
* @(#)TFrame.java
* @author T^&*( W*(%^&$
* @version 2.00 2009/9/23
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class TFrame extends JFrame {
     private Account account;
     public TFrame(Account opened) {
          account = opened;
          setTitle("xxxx-xxxx-xxxx-" + account.getAccountNumber());
          setSize(800,500);
          setDefaultCloseOperation(EXIT_ON_CLOSE);
     // Creates MenuBar
          JMenuBar menuBar = new JMenuBar();
          JMenu file = new JMenu("File");
          file.setMnemonic(KeyEvent.VK_F);
          JMenuItem save = new JMenuItem("Save",KeyEvent.VK_S);
          save.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1, ActionEvent.ALT_MASK));
          file.add(save);
          JMenuItem load = new JMenuItem("Load",KeyEvent.VK_L);
          load.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_2, ActionEvent.ALT_MASK));
          file.add(load);
          JMenuItem print = new JMenuItem("Print",KeyEvent.VK_P);
          print.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_3, ActionEvent.ALT_MASK));
          file.add(print);
          file.addSeparator();
          menuBar.add(file);
     // Finishes MenuBar
          setJMenuBar(menuBar);
     // Creates the RadioPanel that switches type
          JPanel radioPanel = new JPanel();
          radioPanel.setLayout(new FlowLayout());
          ButtonGroup bg = new ButtonGroup();
          JRadioButton deposit = new JRadioButton("Deposit");
          deposit.setMnemonic(KeyEvent.VK_D);
          deposit.setActionCommand("Deposit");
          JRadioButton withdraw = new JRadioButton("Withdraw");
          deposit.setMnemonic(KeyEvent.VK_W);
          deposit.setActionCommand("Withdraw");
          JRadioButton all = new JRadioButton("All");
          deposit.setMnemonic(KeyEvent.VK_A);
          deposit.setActionCommand("All");
          bg.add(deposit);
          bg.add(withdraw);
          bg.add(all);
          deposit.addActionListener(TransactionPane.INSTANCE);
          withdraw.addActionListener(TransactionPane.INSTANCE);
          all.addActionListener(TransactionPane.INSTANCE);
     // Finishes the RadioPanel
     // Creates the TransactionPane
          TransactionPane.INSTANCE = new TransactionPane(account);
     // Finishes TransactionPane
     // Creates the ActionPane
          JPanel actionPane = new JPanel();
          actionPane.setLayout(new GridLayout(2,3));
          JButton addButton = new JButton("Add");
          JButton removeButton = new JButton("Remove");
          JButton printButton = new JButton("Print");
          JButton saveButton = new JButton("Save");
          JPanel pages = new JPanel();
               JButton lastButton = new JButton("<-");
               JButton nextButton = new JButton("->");
               pages.setLayout(new GridLayout(1,2));
               pages.add(lastButton);
               pages.add(nextButton);
          JButton exitButton = new JButton("Exit");
          actionPane.add(addButton);
          actionPane.add(printButton);
          actionPane.add(pages);
          actionPane.add(removeButton);
          actionPane.add(saveButton);
          actionPane.add(exitButton);
     // Finishes the ActionPane
     // Creates the TPanel
          TPanel tPanel = new TPanel(account);
          tPanel.add(radioPanel, BorderLayout.NORTH);
          tPanel.add(TransactionPane.INSTANCE, BorderLayout.CENTER);
          tPanel.add(actionPane, BorderLayout.SOUTH);
          getContentPane().add(tPanel, BorderLayout.CENTER);
     // Finishes the TPanel
          pack();
          setVisible(true);
* @(#)TPanel.java
* @author
* @version 1.00 2009/9/24
import java.awt.*;
import javax.swing.*;
public class TPanel extends JPanel {
     private Account account;
     public TPanel(Account acc) {
          account = acc;
          setPreferredSize(new Dimension(800,480));
}

ok
Edited by: Caarmel on Sep 25, 2009 1:12 AM

Similar Messages

  • Components not showing up in Flash CS5

    What's the correct way to install components in Flash CS3?
    first I tried to install the NewGrounds Ad component for AS 3.0 which delivers as an .xmp file. I doubleclicked it and in the Extension Manager it's listed as active under Flash CS5. I restarted flash, but the component does not show up in the components list.
    I then tried to install the minimal components from http://minimalcomps.com/ which are delivered as an SWC. I went to the ActionScript 3.0 settings in flash, went to the "library path" tab and clicked browse to swc to select the SWC file. but these components don't show up in the components list either.
    So what am I doing wrong?
    Thanks

    1. Go to HELP > MANAGE EXTENSIONS
    2. Choose Flash
    3. Choose FILE > "Install Extension"
    4. Install xxx.mxp from below locations one of them (you may need to show system folders on Windows to see).
    5. I checked these folders on my machine but they were empty,,, but I already have components installed.
    C:\Users\userName\AppData\Local\Adobe\Flash CS4\en\Configuration
    if u can't find it try to go to the below path:
    C:\Users\userName\AppData\Local\Adobe\Flash CS4\ar\Configuration
    and copy all files existing in this folder to:
    C:\Users\userName\AppData\Local\Adobe\Flash CS4\en\Configuration

  • ADF visualization components not showing in a region

    I have a task-flow of JSF fragments, when I visit a page with adf visualization components they are not showing. I call:
    region.queueActionEventInRegion(getMethodExpression(methodExpression),
    null, null, false, -1, -1,
    PhaseId.ANY_PHASE);
    They dont show even iif I call
    AdfFacesContext.getCurrentInstance().addPartialTarget(getRegion());
    Only loads when I collapse a panel - which suggests they are there, loaded. Just not showing.

    Hi,
    if you want to refresh a region then either you call the refresh method exposed on the region or configure the Task Flow binding refresh condition to #{1==} (for always to refresh) in addition to the PPR refresh.
    The first of your method really has nothing to do with region refresh and is for a different usecase
    Frank

  • Components not showing in java 1.4

    I have a small program where some JLabels, JTextFields, JComboBoxes and JCheckBoxes are shown in a JFrame. It works fine in JBuilder 7 but when I tried to run it outside JBuilder, where I have java 1.4.1 installed, the components are not showing correctly. The JLabels are not shown att all and the rest of the components are not fully painted, if at all. If I run it from the bin directory in JBuilder, where java 1.3 is installed, the program works fine.
    Anybody have any idea what could be wrong?

    I have tried compiling both with javac and in JBuilder and in JBuilder and java 1.3 it works fine, but with java 1.4.1 it doesn't.
    I am not using any special JBuilder layout, I have written all the code by hand (haven't figured out the design function in jBuilder yet).

  • New installed components not showing in components panel in cs4

    Hi,
    I'm currently reading the excellent book "ActionScript 3.0
    Quick Reference Guide". In some chapters, the authors ask us to
    install third-party components. They install well in the Extension
    Manager CS4, but for a reason I don't know, they're not showing in
    the Components panel...
    I use Flash CS4... but I also have Flash 8 and Flash CS3
    installed (in fact, all the suites) and it never caused problems
    before, so I don't think that's the problem... By the way, if I
    install them in CS3, they show up in the panel.
    FYI, I have a French Canadian Windows XP version and I work
    with English Flash versions...
    Particularly, the extensions I tried are:
    - as3webservice by Pieter Michels (wellconsidered.com);
    - Yahoo! Astra Library (by Yahoo!, of course);
    - Accordion Panel V3AS3 (by JumpeyeComponents).
    Thank you.

    Well, we're making progress...
    No, there're not in that folder, but from what I understand,
    they shouldn't be there either, because in that folder, it's the
    place for the default ones (that comes with Flash).
    The ones that we add are in the Documents and Settings
    folder:
    So, since I installed the same components in Flash CS3 and
    Flash CS4 (because they weren't working in CS4), they appear in:
    C:\Documents and Settings\Nelson Therrien\Local
    Settings\Application Data\Adobe\Flash
    CS3\en\Configuration\Components... Good.
    Now, do they appear in Flash CS4 (path C:\Documents and
    Settings\Nelson Therrien\Local Settings\Application
    Data\Adobe\Flash CS4\en\Configuration\Components)... NO!!
    BUT!! I don't know if it's because I tried the French version
    once or because I have a French Operating System, but I also have a
    fr folder (full path: C:\Documents and Settings\Nelson
    Therrien\Local Settings\Application Data\Adobe\Flash
    CS4\fr\Configuration\Components) and... THEY APPEAR THERE!!
    So, I copied them from the fr folder to the en folder and
    Voilà! They now appear inside the Flash CS4 Components
    Panel...!
    Thank you for pointing me in the right direction!
    Nelson

  • FlowLayout wrapped components not showing when nested in a GridBagLayout

    Hello, I'm having a problem when adding multiple components to a FlowLayout that is inside a grid of a GridBagLayout. I'd love to post some code, but it's really entrenched, so I'll try to give an a decent verbal example below.
    The problem is that when I fill a grid in the GridBagLayout, it happily goes to the end of the JScrollPane it's nested inside (this is necessary for vertical movement, but horizontal is disabled). When I add a JPanel to this right-most grid, and set it FlowLayout, and then add any n components, the components plow right off the right side of the screen (and again, having a horizontal scroller is not acceptable to the users).
    I've tried screwing around with setting the preferred size: if I set the preferred width to 0 (or to anything smaller than the width of the JScrollPane), the FlowLayout wraps the components (good) but doesn't take up the height it needs to display them (bad). They get stuck "under" whatever is painted next. If I set the preferred height to some arbitrary value, it will show them, but maintains that value even when the window is resized, so again some components get buried.
    Further, the arbitrary size that I'm setting can't be calculated, as I can't get the preferred size (or any size) of the FlowLayout until after it's been drawn to the screen!
    Is there something that I'm missing here, or some trick that I haven't stumbled across before to make this work the way that I want it to? (That being that a JPanel nested in some grid in a GridBagLayout, and having sufficient GridBagConstraints, and being set to FlowLayout, will display all the components dropped in it, wrapping them as they reach the end of the JScrollPane that encapsulates the GridBagLayout).
    Any help is greatly appreciated!

    I've found a reasonable solution to my problem:
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=780453
    contains code for an extended FlowLayout called "BetterFlowLayout" which works in a much more friendly way with JScrollPane. It seems the problem wasn't so much with the GridBagLayout, but more with the JScrollPane. In any event, anyone having a similar problem can find (and modify) a decent solution from the post above.

  • Plz help me out!! Custom components not showed in JTabbedPane....

    Hi!!
    I am extending a JPanel and adding some components to it and finally when I create an object and add it to the JTAbbedPane its not being shown....If i do it disrectly on JPanel instead of my class its is being shown.can anybody...please help me out and tell where the problem is ...My code is as follows....
    public class TabColorExample extends JPanel {
    public TabColorExample() {
    setLayout(new BorderLayout());
    UIManager.put("TabbedPane.selected", Color.green);
    JTabbedPane tabbedPane = new JTabbedPane();
    String tabs[] = {"One", "Two", "Three", "Four"};
    Color[] colors = {null, Color.red, null, null};
    for (int i=0;i<tabs.length;i++) {
    tabbedPane.addTab(tabs, createPane(tabs[i]));
    tabbedPane.setBackgroundAt(i, colors[i]);
    tabbedPane.setSelectedIndex(0);
    add(tabbedPane, BorderLayout.CENTER);
    JPanel createPane(String s) {
    return new panel(s);
    public static void main(String[] args) {
    JFrame frame = new JFrame("Tab color Example");
    frame.addWindowListener( new WindowAdapter() {
    public void windowClosing( WindowEvent e ) {
    System.exit(0);
    frame.getContentPane().add( new TabColorExample() );
    frame.setSize( 200, 100 );
    frame.setVisible(true);
    class panel extends javax.swing.JPanel
         panel(String s)
              super();
              JPanel p = new JPanel();
              p.add(new JLabel(s));
    Thanx in advance...
    Krtrao

    Hi there,
    Having that string in a mapping of DSO when DSO will process the SIDs it doesn't like that string and therefore throws an error.
    You could for example transform that field in for example start routine or customer exit R/3 side, like for example split string with commas, and concatenate everything like this: 01,02,03 should retrieve 010203.
    Other option is to first create master data texts datasource for that field PDP and for each key retrieves a string, like this for example:
    010203 - text 01,02,03, or text MDTDWD
    than when you fill the DSO with that field aready fixed in the form 010203, you can in the query represent it with text, it should represent in the form 01,02,03 or MDTDWD, see the picture?
    You can do this kind of fixing of the filed 01,02,03 or in the start routine, or the transfer structure.
    And to only get those records with the field being there, just write in the start routine something like:
    DELETE <SOURCE_PACKAGE> where your_field is initial.
    Hope this helps,
    Diogo.

  • JComponent not showing in JPanel

    I've tried the add() method but nothing is displayed when I try to add Test to GraphicsTest. How should I be adding it? Can someone show me? I've included the code I'm using.
    This is my way and it's not working. Can someone show me or make me aware of what the problem actually is?
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.geom.Rectangle2D;
    import javax.swing.JPanel;
    public class GraphicsTest extends JPanel
        private Graphics2D g2d;
        private String state;
        private int x, y;
        GraphicsTest()
            Test t = new Test();
            t.setVisible(true);
            add(t);
        @Override
        public void paintComponent(Graphics g)
            super.paintComponent(g);
            g2d = (Graphics2D) g;
            g2d.setColor(Color.BLACK);
            g2d.drawString("STATE: " + state, 5, 15);
            g2d.drawString("Mouse Position: " + x + ", " + y, 5, 30);
            g2d.setColor(Color.red);
            Rectangle2D r2d = new Rectangle2D.Double(x, y, 10, 10);
            g2d.draw(r2d);
            g2d.dispose();
        public void setState(String state) { this.state = state; }
        public String getState() { return state; }
        public void setX(int x) { this.x = x; repaint(); }
        public void setY(int y) { this.y = y; repaint(); }
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import javax.swing.JComponent;
    public class Test extends JComponent
        @Override
        public void paintComponent(Graphics g)
            super.paintComponent(g);
            Graphics2D g2d = (Graphics2D) g.create();
            g2d.setColor(Color.red);
            g2d.drawString("Hello", 50, 50);
            g2d.dispose();
    }

    The object in Test ("hello") is not appearing.
    import java.awt.EventQueue;
    //import java.awt.event.MouseEvent;
    //import java.awt.event.MouseListener;
    //import java.awt.event.MouseMotionListener;
    import javax.swing.JFrame;
    public class MainWindow
        public static void main(String[] args)
            new MainWindow();
        JFrame frame;
        GraphicsTest gt = new GraphicsTest();
        MainWindow()
            EventQueue.invokeLater(new Runnable() {
                public void run() {
                    frame = new JFrame("Graphics Practice");
                    frame.setSize(680, 420);
                    frame.setVisible(true);
                    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    //                gt.addMouseListener(new MouseListener() {
    //                    public void mouseClicked(MouseEvent e) {}
    //                    public void mousePressed(MouseEvent e) {}
    //                    public void mouseReleased(MouseEvent e) {}
    //                    public void mouseEntered(MouseEvent e) {
    //                        gt.setState("Mouse has entered");
    //                    public void mouseExited(MouseEvent e) {
    //                        gt.setState("Mouse has not entered");
    //                gt.addMouseMotionListener(new MouseMotionListener() {
    //                    public void mouseDragged(MouseEvent e) {}
    //                    public void mouseMoved(MouseEvent e) {
    //                        gt.setX(e.getX());
    //                        gt.setY(e.getY());
                    frame.add(gt);
    }

  • Video components not showing up in flash

    I am only using Flash MX 6, so I hope it is ok, but I am
    having a major problem.
    First I need a video component that works, hopefully there is
    a few one that is floating around out there.
    I have a QT.mov, I have converted it to flash and I drop a
    video component on it (surprisingly, it looks like the QT
    controls). I test the movie, it works, but when I use the swf in
    Dreamweaver on my page, the controls are no where to be seen. I
    can't see them, therefore they are useless to me!!I have tried Muak
    one, it doesn't seem to link to my movie no matter what I do, along
    with VideoController 1_1 which doesn't seem to show up in my movie.
    Has anyone else had this problem? How can I resolve it?
    Thanks in advance.

    1. Go to HELP > MANAGE EXTENSIONS
    2. Choose Flash
    3. Choose FILE > "Install Extension"
    4. Install xxx.mxp from below locations one of them (you may need to show system folders on Windows to see).
    5. I checked these folders on my machine but they were empty,,, but I already have components installed.
    C:\Users\userName\AppData\Local\Adobe\Flash CS4\en\Configuration
    if u can't find it try to go to the below path:
    C:\Users\userName\AppData\Local\Adobe\Flash CS4\ar\Configuration
    and copy all files existing in this folder to:
    C:\Users\userName\AppData\Local\Adobe\Flash CS4\en\Configuration

  • JSF Components not showing on all projects.

    I am working with 10.1.3, I have a web project using JSF and ADF BCs. The original project works fine and I can see the tags in JSP Visual Editor but when I create a new project, all I see is tags. All JSP tags in the project properties have the "Execute Tags in JSP Visual Editor" checked. Any clues?
    I used the example at http://www.oracle.com/technology/products/jdev/howtos/10g/jsf_howto/jsf.html?_template=/ocom/technology/content/print

    It's weird. When I look for them under the artist tab they don't show. But if I do a search or look under the album tab I can see them. Guess they still have a lot of bugs to work out.

  • Components not showing up on dialog box

    Hi,
    I'm building a little progrma tha displays points and lines. I have a dialob box that pops up to get point coordinates, once the user enters the point data and clicks the display button it displays the point. here is my problem, when the dialog box pops up to enter another point only the buttons and on radio button in the dialog box are visible the rest are no, however if I click on some of the items inthe dialog box like a text field it sometimes shows up.
    any help would be great
    Jim

    Hi,
    I'm building a little progrma tha displays points and lines. I have a dialob box that pops up to get point coordinates, once the user enters the point data and clicks the display button it displays the point. here is my problem, when the dialog box pops up to enter another point only the buttons and on radio button in the dialog box are visible the rest are no, however if I click on some of the items inthe dialog box like a text field it sometimes shows up.
    any help would be great
    Jim

  • I add components to contentPane, but JFrame still does not show them

    I converted a small game I was making from AWT to Swing.(The game is just MineSweeper.) I made all the necessary adjustments like, Button to JButton and add() to getContentPane().add(), but when I show the JFrame, it does not show any components that I added. I have run test programs to see if I am adding the components correctly and they work.
    I print out the number of components contained in the frame by using getComponentCount() and the number is correct. It just will not show up in the JFrame. I have tried everything I can think of, no matter how strange and it still will not show the components.
    I have attached all the code to the bottom of this message. Can someone please take a look and see what I am missing.
    Thanks.
    Here's the code. The main file is at the end and is the one causing the problems. All the rest is just support stuff and should not be relavent, but I included it in case I missed something there.
    //Timer is just a custom timer
    import java.util.Date;
    public class Timer {
         Date curr;
         public Timer() {
              curr=new Date();
         public void start() {
              curr=new Date();
         public int getSeconds() {
              return (int)(((new Date().getTime())-curr.getTime())/1000);
    //Cover subclasses JButton for initial look
    import java.awt.*;
    import javax.swing.*;
    public class Cover extends JButton {
         Dimension size;
         public Cover() {
              super("");
              size=new Dimension(20,20);
              setSize(size);
         public Cover(String l) {
              super("");
              size=new Dimension(20,20);
              setSize(size);
         public void setSize(Dimension s) {
              super.setSize(size);
         public Dimension getPreferredSize() {
              return size.getSize();
         public Dimension getMinimumSize() {
              return size.getSize();
         public Dimension getMaximumSize() {
              return size.getSize();
    //Flag subclasses JButton to flag a mine
    import java.awt.*;
    import javax.swing.*;
    public class Flag extends JButton {
         Dimension size;
         public Flag() {
              super("F");
              size=new Dimension(20,20);
         public Flag(String l) {
              super("F");
              size=new Dimension(20,20);
         public void setSize(Dimension s) {
              super.setSize(size);
         public Dimension getPreferredSize() {
              return size.getSize();
         public Dimension getMinimumSize() {
              return size.getSize();
         public Dimension getMaximumSize() {
              return size.getSize();
    //Reveal subclasses JPanel to show what's underneath
    import java.awt.*;
    import javax.swing.*;
    public class Reveal extends JPanel {
         Dimension size;
         int number;
         Color color[];
         public Reveal(int n) {
              super();
              size=new Dimension(20,20);
              number=n;
              color=new Color[10];
              color[0]=Color.black;
              color[1]=Color.orange;
              color[2]=Color.cyan;
              color[3]=Color.yellow;
              color[4]=Color.green;
              color[5]=Color.magenta;
              color[6]=Color.blue;
              color[7]=Color.pink;
              color[8]=Color.darkGray;
              color[9]=Color.red;
              //for(int x=0;x<10;x++) {
              //     System.out.println(x+"="+color[x]);
              setBackground(Color.black);
         public void paintComponent(Graphics g) {
              int width=getWidth();
              int height=getHeight();
              FontMetrics fm=g.getFontMetrics();
              int fw=0;
              int fh=fm.getAscent();
              g.setColor(color[number]);
              if(number==9) {
                   fw=fm.stringWidth("M");
                   g.drawString("M",width/2-(fw/2),height/2+(fh/2));
              else if(number!=0) {
                   fw=fm.stringWidth(""+number);
                   g.drawString(""+number,width/2-(fw/2),height/2+(fh/2));
              g.setColor(Color.white);
              g.drawRect(1,1,width-2,height-2);
              //System.out.println("number="+number);
         public void setNumber(int n) {
              number=n;
         public int getNumber() {
              return number;
         public Dimension getPreferredSize() {
              return size.getSize();
         public Dimension getMinimumSize() {
              return size.getSize();
         public Dimension getMaximumSize() {
              return size.getSize();
    //MineSweeper just launches the program and subclasses JFrame
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class MineSweeper extends JFrame implements ComponentListener {
         public MineSweeper(String s) {
              super(s);
              addComponentListener(this);
         public void quit() {
              System.exit(0);
         public void componentHidden(ComponentEvent e){}
         public void componentMoved(ComponentEvent e){}
         public void componentResized(ComponentEvent e){
              System.out.println("resized");
              MineSweeper temp=(MineSweeper)e.getSource();
              System.out.println("count="+temp.getContentPane().getComponentCount());
         public void componentShown(ComponentEvent e){}
         public static void main(String args[]) {
              MineSweeper t=new MineSweeper("Inside Moves");
              t.addWindowListener(new WindowAdapter() {
                   public void windowClosing(WindowEvent e) {
                        System.exit(0);
              GameManager manager=new GameManager(t);
    //GameManager is the main program. This is where the JFrame is realized
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import javax.swing.*;
    public class GameManager implements MouseListener, ActionListener, Runnable {
         JPanel display;
         JPanel gameInfo;
         MineSweeper screen;
         JButton reset;
         JTextField tMine,time;
         Container pane;
         int clickX,clickY;
         int minesLeft;
         int gridX[],gridY[],mine[];
         static final int MAX_X=30;
         static final int MAX_Y=24;
         static final int MAX_MINE=667;
         JComponent grid[][];
         int board[][];
         int number[][];
         final static int OB=64;
         final static int BLANK=0;
         final static int MINE=1;
         final static int REVEAL=128;
         int level;
         final static int EASY=0;
         final static int MEDIUM=1;
         final static int HARD=2;
         final static int CUSTOM=3;
         int state;
         final static int START=1;
         final static int PLAYING=2;
         final static int DONE=3;
         Timer timer;
         int timeDisp;
         public GameManager(MineSweeper s) {
              screen=s;
              pane=screen.getContentPane();
              pane.setLayout(new BorderLayout());
              display=new JPanel();
              gameInfo=new JPanel(new GridLayout(1,3));
              reset=new JButton("Reset");
              tMine=new JTextField(20);
              time=new JTextField("0",20);
              grid=new JComponent[MAX_X+2][MAX_Y+2];
              board=new int[MAX_X+2][MAX_Y+2];
              number=new int[MAX_X+2][MAX_Y+2];
              gridX=new int[4];
              gridY=new int[4];
              mine=new int[4];
              level=EASY;
              gridX[0]=8;
              gridY[0]=8;
              mine[0]=10;
              gridX[1]=16;
              gridY[1]=16;
              mine[1]=40;
              gridX[2]=30;
              gridY[2]=16;
              mine[2]=99;
              gridX[3]=0;
              gridY[3]=0;
              mine[3]=0;
              minesLeft=mine[level];
              tMine.setText(""+minesLeft);
              state=START;
              timer=new Timer();
              reset.addActionListener(this);
              setup();
              Thread t=new Thread(this);
              t.start();
              /*System.out.println("count="+pane.getComponentCount());
              Component cc[]=pane.getComponents();
              for(int i=0;i<cc.length;i++) {
                   System.out.println("cc="+cc);
         public void setup() {
              boolean done;
              for(int x=0;x<=gridX[level]+1;x++) {
                   for(int y=0;y<=gridY[level]+1;y++) {
                        if(x==0 || x==gridX[level]+1 || y==0 || y==gridY[level]+1) {
                             board[x][y]=OB;
                             number[x][y]=-1;
                        else {
                             board[x][y]=BLANK;
              for(int i=0;i<mine[level];i++) {
                   done=false;
                   while(!done) {
                        int x=(int)((Math.random()*gridX[level])+1.0);
                        int y=(int)((Math.random()*gridY[level])+1.0);
                        if(board[x][y]==BLANK) {
                             board[x][y]=MINE;
                             done=true;
                             //System.out.println("Mine x="+x+" y="+y);
              for(int y=1;y<=gridY[level];y++) {
                   System.out.print("\n");
                   for(int x=1;x<=gridX[level];x++) {
                        number[x][y]=0;
                        if(board[x][y]==MINE) {
                             number[x][y]=9;
                             System.out.print(""+number[x][y]);
                             continue;
                        else {
                             //System.out.println("For board pos x="+x+" y="+y);
                             for(int i=-1;i<=1;i++) {
                                  for(int j=-1;j<=1;j++) {
                                       //System.out.print(""+board[x+i][y+j]);
                                       if(board[x+i][y+j]!=OB && board[x][y]==BLANK) {
                                            number[x][y]+=board[x+i][y+j];
                                  //System.out.print("\n");
                             System.out.print(""+number[x][y]);
              System.out.print("\n");
              screen.setVisible(false);
              display.removeAll();
              pane.removeAll();
              display.setLayout(new GridLayout(gridY[level],gridX[level]));
              for(int y=1;y<=gridY[level];y++) {
                   for(int x=1;x<=gridX[level];x++) {
                        Cover temp=new Cover();
                        //System.out.println("new button="+temp);
                        grid[x][y]=temp;
                        //System.out.println("display="+display.add(temp));
                        //display.add(temp);
                        temp.addMouseListener(this);
              //System.out.println("count="+display.getComponentCount());
              screen.setSize(gridX[level]*20,gridY[level]*20+30);
              pane.add(gameInfo,BorderLayout.NORTH);
              pane.add(display,BorderLayout.CENTER);
              minesLeft=mine[level];
              timeDisp=0;
              tMine.setText(""+minesLeft);
              time.setText(""+timeDisp);
              state=START;
              //System.out.println("gameInfo="+gameInfo);
              //System.out.println("display="+display);
              //screen.pack();
              screen.setVisible(true);
         void revealAround(int x,int y) {
              int index;
              Reveal tempRev=new Reveal(number[x][y]);
              grid[x][y]=tempRev;
              board[x][y]=(board[x][y]|REVEAL);
              index=(x-1)+((y-1)*gridX[level]);
              display.remove(index);
              display.add(tempRev,index);
              if(number[x][y]==0) {
                   for(int i=-1;i<=1;i++) {
                        for(int j=-1;j<=1;j++) {
                             if(!(i==0 && j==0)) {
                                  if((board[x+i][y+j]&REVEAL)!=REVEAL && board[x+i][y+j]!=OB) {
                                       revealAround(x+i,y+j);
         void startTimer() {
              timer.start();
         public void run() {
              while(true) {
                   if(state==PLAYING) {
                        if(timer.getSeconds()>timeDisp) {
                             timeDisp=timer.getSeconds();
                             time.setText(""+timeDisp);
                   else {
                        try {
                             Thread.sleep(1000);
                        catch (InterruptedException e) {
         public void actionPerformed(ActionEvent e) {
              if(e.getActionCommand().equals("Reset")) {
                   setup();
         public void mouseClicked(MouseEvent e) {
              if(state==START) {
                   startTimer();
                   state=PLAYING;
              if(state==PLAYING) {
                   Component tempComp=(Component)e.getSource();
                   boolean found=false;
                   int index=0;
                   int buttonPressed=e.getModifiers();
                   for(int x=1;x<=gridX[level];x++) {
                        if(found) {
                             break;
                        for(int y=1;y<=gridY[level];y++) {
                             if(tempComp==grid[x][y]) {
                                  clickX=x;
                                  clickY=y;
                                  found=true;
                                  break;
                   index=(clickX-1)+((clickY-1)*gridX[level]);
                   if(buttonPressed==InputEvent.BUTTON1_MASK && !(grid[clickX][clickY] instanceof Flag)) {
                        Reveal tempRev=new Reveal(number[clickX][clickY]);
                        grid[clickX][clickY]=tempRev;
                        board[clickX][clickY]=board[clickX][clickY]|REVEAL;
                        display.remove(index);
                        display.add(tempRev,index);
                   else if(buttonPressed==InputEvent.BUTTON3_MASK) {
                        if(display.getComponent(index) instanceof Cover) {
                             Flag tempFlag=new Flag();
                             grid[clickX][clickY]=tempFlag;
                             display.remove(index);
                             display.add(tempFlag,index);
                             tempFlag.addMouseListener(this);
                             minesLeft--;
                        else if(display.getComponent(index) instanceof Flag) {
                             Cover tempCov=new Cover();
                             grid[clickX][clickY]=tempCov;
                             display.remove(index);
                             display.add(tempCov,index);
                             tempCov.addMouseListener(this);
                             minesLeft++;
                        tMine.setText(""+minesLeft);
                   if(number[clickX][clickY]==0) {
                        revealAround(clickX,clickY);
                   screen.setVisible(true);
         public void mousePressed(MouseEvent e) {}
         public void mouseReleased(MouseEvent e) {}
         public void mouseEntered(MouseEvent e) {}
         public void mouseExited(MouseEvent e) {}

    setBounds() is only used for absolute positioning. I
    am using layout managers, so it should no be used.
    Thanks for you reply.Oh I get I did not look at your source code enought... can you post only the part that is bugy!?!?!
    JRG

  • Flex components is not showing up after deploying to web server

    Hello,
    I am working in flex builder 2.0 to develop a simple
    application.
    I am getting some issues around custom components.
    My directory structure is as follows:
    Project_Folder-
    |-Components
    |-bin
    |-assets
    |-Application.mxml
    I put all my custom components in Components folder.
    I have a custom component in there and the application.mxml
    is using
    it.
    the code is somthign like this:
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute" xmlns:test="Components.*"
    backgroundGradientColors="[#000000, #000000]">
    <test:baseLayer horizontalCenter="0" top="0"/>
    </mx:Application>
    Here base layer is the custom component.
    My problem is when i ran it it is workign fine, but when I am
    deploying it in the apache server teh Custom components are
    not
    showing up. I copied all contents of the bin folder to my web
    server
    root.
    I am not sure if it will need some extra task to deploy the
    custom
    component?
    I thought since it is in the same project the swf file
    already packed
    with the custom components.
    Please can anyone help me to clarify that?
    thank you,

    Thanks, this makes sense. Can you tell me how I upload the whole scripts
    folder to justhost.com? When I try to select the folder at upload it opens
    the folder as if I should then select a single file ( like the
    AC_RunActiveContent.js file that is in the folder) So that is what I did.
    Which makes sense that the path is now broken for the flash cause it is not
    in the folder anymore.  In other words what I don't understand is how to get
    my scripts folder and its contents as a whole uploaded to the Justhost.com.
    Thanks your email has been very helpful!
    10/14/09 12:32 [email protected]
    I did finally figure out the problem.
    In my case, I was putting all of my files directly into justhost.com with no
    regard for the way the files were classified in the original folders used to
    build my site. In other words, you can't just put AC_RunActiveContent.js into
    justhost.com randomly and expect that your Flash will work.
    Instead, you have to create a Scripts folder and then put
    AC_RunActiveContent.js within the scripts folder.  This sets up the paths to
    function the way they were originally created on your Dreamweaver document (or
    whatever the html editor you may happen to be using).
    Whether dealing with Flash or images, the main thing to remember is that you
    have to mirror the structure of your original folders/files exactly.
    So try creating a folder called Scripts, then place the AC_RunActiveContent.js
    file inside of this Scripts folder, and see if that works.  I assume the foder
    AC_RunActiveContent.js is within Scripts, but if it called something
    different, just copy the name (exactly), and put AC-RunActiveContet inside of
    it.
    I hope this helps,
    sherwulff
    >

  • The JPanel did not show when the menu is selected

    My program consists a JMenu bar with sub menu items. When the user select on the menu items a panel with the gridbag layout will show with all the labels.but the panel did not show. Can anyone show the problem for me ?
    AdminFrameMain.java
    public class AdminFrameMain
         private DisplayMenuBar menubar;
         private DisplayToolBar toolbar;
         private DisplayStatusBar statusbar;     
         public AdminFrameMain()
              JFrame frame = new JFrame("S-League Administration Management System");
              Toolkit kit = frame.getToolkit();
              Dimension windowsize =kit.getScreenSize();
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              Container content = frame.getContentPane();
              content.setLayout(new BorderLayout());
              menubar = new DisplayMenuBar(frame,content);
              toolbar = new DisplayToolBar(content);
              statusbar = new DisplayStatusBar(content);
              frame.setSize(800,600);
              frame.setVisible(true);
         public static void main(String [] args){
              AdminFrameMain tm = new AdminFrameMain();
    DisplayMenuBar.java
    public class DisplayMenuBar
         private JMenu addMenu,addTeamMenu;
         private JMenuBar bar = new JMenuBar();
         private JToolBar toolbar = new JToolBar();
         private JMenuItem addTeamItem;
         private JFrame setFrame;
         private Container setContent;
         private AddTeamManagement addTeamMang;
         public DisplayMenuBar(JFrame frame,Container c)
              setFrame = frame;
              setContent = c;
              SetMenuBar();
         public void SetMenuBar()
         setFrame.setJMenuBar(bar);
         addMenu = new JMenu("Add");
         //file menu items list
         //Add sub menu
         addTeamMenu = new JMenu("Team Management");
         addMenu.add(addTeamMenu);
         //Add sub menu items
         addTeamMenu.add(addTeamItem = new JMenuItem("Add Team"));
         addTeamMenu.setMnemonic('T');     
         addTeamItem.setMnemonic('T');
         //team items listener
         //addTeamItem.addActionListener(taskcommand);          
         addTeamItem.addActionListener(new ActionListener()
              public void actionPerformed(ActionEvent e)
                   AddTeamManagement addTeamMang = new AddTeamManagement(setFrame,setContent);
         bar.add(addMenu);
    AddTeamManagement.java
    public class AddTeamManagement
         private JPanel addTeamPanel;
         private JFrame frame;
         private JButton createTeamBt,resetTeamBt;
         private Container addTeamContent;
         private JTextArea teamDescTextArea,teamIndpTextArea;
         private JTextField teamNameField;
         private JLabel teamID,teamDesc,teamInfo,numOfPlayers,teamZone,playersNum;
         private GridBagLayout gridBag;
         private GridBagConstraints constraints;
         public AddTeamManagement(JFrame f,Container c)
              System.out.println("add team mg");
              addTeamPanel = new JPanel();
              frame = f;
              addTeamContent = c;
              gridBag = new GridBagLayout();
              addTeamPanel.setLayout(gridBag);
              addTeamPanel.setBackground(Color.pink);
              constraints = new GridBagConstraints();
              teamID = new JLabel("Team ID:");
              teamDesc = new JLabel("Team Description:");
              teamInfo = new JLabel("Team Info:");
              numOfPlayers = new JLabel("No Of Players:");
              playersNum = new JLabel("15 Maximun");
              teamZone = new JLabel("Team Zone:");
              constraints.fill = constraints.VERTICAL;
              constraints.weightx = 1;
              constraints.weighty = 0;
              addComponent(teamID,0,0,1,1);
              constraints.fill = constraints.VERTICAL;
              constraints.weightx = 1;
              constraints.weighty = 0;
              addComponent(teamDesc,1,0,1,1);
              constraints.fill = constraints.VERTICAL;
              constraints.weightx = 1;
              constraints.weighty = 0;
              addComponent(teamInfo,2,0,1,1);
              constraints.fill = constraints.VERTICAL;
              constraints.weightx = 1;
              constraints.weighty = 0;
              addComponent(numOfPlayers,3,0,1,1);
              constraints.fill = constraints.VERTICAL;
              constraints.weightx = 1;
              constraints.weighty = 0;
              addComponent(teamZone,4,0,1,1);
              System.out.println("showing");
              addTeamContent.add(addTeamPanel,BorderLayout.CENTER);
         public void addComponent(Component component,int row,int column,int width,int height)
              System.out.println("adding c");
              constraints.gridx = column;
              constraints.gridy = row;
              constraints.gridwidth = width;
              constraints.gridheight = height;
              gridBag.setConstraints(component,constraints);
              addTeamPanel.add(component);
              addTeamPanel.setVisible(true);
    }

    Hello,
    you are missing only one link, just add following line to your actionPerformed method of DisplayMenuBar class and all problem will be solved
    setContent.validate();
    Actually, Swing component does not updated automatically. when you do any changes to the component layout it will set that component as invalidated component. To update the view you need to call validate() method defined in JComponent class.
    Virus

  • Workflow link not showing in enterprize manager system components

    Hi,
    I just started with Oracle Apps and have installed infra, midtier , midtierjsp and a remote repository.
    As part of the install I installed OWF.
    Problem is it does not show up in the midtier system components.
    I restarted all components and servers severl times with no luck.
    I opened a tar with Oracle and poor response.
    I got a metalink article : 265554.1 and I followed the instructions there , which was exactly what I did prior, but still no OWF showing.
    Below is the last lines from ny workflow install. Any help will be greatly appreciated and this is rather urgert.
    Thanks,
    Praim Sankar
    [email protected]
    Commit complete.
    Disconnected from Oracle Database 10g Release 10.1.0.2.0 - Production
    WorkflowCA: Configuration files were not updated.
    WorkflowCA: Workflow Configuration has completed successfully.
    WorkflowCA: Terminating...

    Hi,
    I can see only one difference with my code:
    I placed using detectives in namespace:
    namespace Crm_RTB_NewAcc.Workflow
    using System;
    using System.Activities;
    using System.ServiceModel;
    using Microsoft.Xrm.Sdk;
    using Microsoft.Xrm.Sdk.Workflow;
    using Microsoft.Xrm.Sdk.Query;
    public sealed class GetOrgLicense : CodeActivity
    // Define Inputs/Outputs
    [Output("Count")]
    public OutArgument<int> Count { get; set; }
    protected override void Execute(CodeActivityContext executionContext)
    //My code here
    Count.Set(executionContext, 5);
    Try to make same code. It working well. 
    Hi xjomanx,
    I just tried your suggestion, but still the class is not appearing in the plugin registration. Btw, could you please confirm what version of PluginRegistration you are using?
    blog: <a href="http://technologynotesforyou.wordpress.com">http://technologynotesforyou.wordpress.com</a> | skype: ali.net.pk

Maybe you are looking for

  • Unable to connect to Services Registry(error) while connecting from NWDS

    Hi SDN friends, I am trying to do WSDL import from NWDS (Developer Studio SAP NetWeaver 7.1 Composition Environment SP03 PAT0000 Build id: 200710302120 ) and i am getting  following error "Unable to connect to Services Registry" Below are  the servic

  • External Hard drive not working

    I just bought a 1 TB G Drive. Did so because my 2008 Macbook became very slow and wanted to back up all my data. I first tried doing so through disk utility and I thought it backed it up but when I checked nothing was there. Then went through time ma

  • PDF printing with wrong colours

    Hi, I have created a document in indesign 5 and have now converted to a PDF file, on screen all is well but when I print the file all the colours are changing in a big way. The file includes illustrator images, photoshop photographs and text from ind

  • Airport itunes

    I received my airport express I have wireless internet upstairs.. stereo downstairs that my airport is hooked to via rca jack. I can either surf the net or play my stereo but not both at the same time. Did I do something wrong or is this the way it i

  • OIM SSL cert with AD

    I have a OIM on a cluster with two nodes running on WLS. I have a VIP URL that I connect to OIM with. i am going to upload the OIM cert to AD for provisioning etc and get AD cert in OIM jdk keystore. What I need to know is what hostname shall I use i