Problem setting ImageIcon onto JLabel

Hi guys I am currently writing a Pente board game.
Now I have two classes called Stone and GameStatus.
In the GameStatus constructor it basically generates a JPanel and I try to fill it with 19 x 19 JLabel and add a mouselistener to each of them. This way when the label gets clicked, I can change the Image of it to represents empty spot, with white stone or with black stone.
Here is the code of Stone class
package pente;
import javax.swing.*;
public class Stone extends JLabel
  // the color of the Stone object
  private String color;
  private int x, y; // the location of current Stone
  boolean occupied; // see if the spot is occupied
  // the location of each image file
  private final String EMPTY = "c:/empty.jpg";
  private final String BLACK = "c:/black.jpg";
  private final String WHITE = "c:/white.jpg";
  // private JLabel label = new JLabel();
  * The default constructor that initializes a
  * Stone object with a given color.
  public Stone(int x, int y, boolean o, String c)
      this.x = x;
      this.y = y;
      this.occupied = o;
      this.color = "empty"; // the color has not yet been set
      this.setIcon(new ImageIcon(EMPTY));
    // assign the given color to the Stone
   * This method sets the image of the current object depends on
   * the given variable c.
   * @return the Stone object with an appropriate image on it
  public Stone setColor(String c)
      // swtich the image of the Panel depends on the c given
      if ((c.equals("w")) || (c.equals("white")))
        this.color = "white";
        this.setIcon(new ImageIcon(WHITE));
      else if ((c.equals("b")) || (c.equals("black")))
          this.color = "black";
          this.setIcon(new ImageIcon(BLACK));
      return this;
   * This method replaces the current image with the empty image
   * @return the Stone object with empty image on it
  public Stone setEmpty()
      this.color = "empty";
      this.setIcon(new ImageIcon(EMPTY));
      return this;
   * This method gets the x coordinate of Stone
   * @return the x coordinate
  public int getX()
      return this.x;
   * This method gets the y coordinate of Stone
   * @return the y coordinate
  public int getY()
      return this.y;
   * This method tests if the current Stone has been set to a color
   * @return if the Stone has been set to a color
  public boolean isOccupied()
      return (!(this.color).equals("empty"));
}Here is the part where GameStatus calls Stone class
public GameStatus(int size)
        this.setTitle("PENTE");
        this.setLocation(100,30);
        this.setSize(747,695);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JPanel p = new JPanel();
        p.setLayout(new GridLayout(0, size, 0, 0));
        // initializes the array and starts inserting labels
        for (int i = 0; i < size ; i++)
            for (int j = 0; j < size ; j++)
                array[i][j] = new infoArray(i, j, false, EMPTY);
                Stone s = new Stone(i, j, false, EMPTY);
                s.addMouseListener(new MousePressListener());
                p.add(s);
        this.setResizable(false);
        this.getContentPane().add(p);
        this.setVisible(true);
        System.out.print("hello");
    }The problem is, there is only one Stone object can be shown on the JPanel.
This is weird since it works fine when I tried to call JLabel object instead of Stone object and fill them into JPanel.
Since Stone class extends JLabel, I just dont see why JLabel works while Stone doesn't.
I need to know the reason badly, so I appreciate any suggestions.
Thanks.

Code looks reasonable. Only comment I have is that icons can be shared by multiple components. So you only need to create 3 icons, one for each state of the stone. Then you just use setIcon to change the state. No need to recreate the icon every time.

Similar Messages

  • Having some problems with ImageIcons and JLabels

    I'm making a checkers game, and so far it's going pretty well.
    I've got the basic game down, and you can move pieces, jump, your turn ends when you can't jump anymore, etc...
    However, I've had three problems:
    1.) I'm using JLabels to display my board (8 x 8.. well actually 9 x 9 for an outer row labelled A,B,C,D.. 1,2,3,4...) Anyway, I create the JLabels using something that looks like \:
    JLabel square = new JLabel(new ImageIcon("pic.png"));
    Now, the picture loads properly, but it seems like the picture is being cropped, and the top and bottom are getting chopped off, so my 36 x 36 pixel *.gif appears to be 36 x 30.
    You can see how there is a gap created in:
    http://img235.imageshack.us/img235/7765/prob13ky.jpg
    Now the problem may be with the GridLayout I am using, but I set the distance between the components in the container to be 0, 0 so I don't think that GridLayout is chopping my icons. I've also tried setPreferredSize(new Dimension(36,36))
    for both my ImageIcons and JLabels and for my container (which I set to size 2000,2000, just to make sure there was room). If anyone can help me, it's be appreciated.
    2.) I used to be able to view my outside row/column of squares that said A,B,C,D.... and 1,2,3,4... with the square in the corner having a random pic. For some reason now (have no clue why) I now see only the pic in the corner, and then a little gray smudge diagonally under it.
    Pic:
    http://img347.imageshack.us/img347/8308/prob24im.jpg
    I don't know what's wrong. I'm pretty sure it's none of the new methods I've written, as those are all in my static void main (String[] ar) ...... and if I comment all the methods in my main except where I first make the JFrame and set it visible, it still turns out like that. repaint() doesn't help.
    3.) For some reason, when I move another window (AIM, the console window, etc...) over my Swing window, it "erases" (turns gray, just wipes clean) the part where I have my squares that have pieces.
    What's weird is that:
    The border pieces (err.. my one visible corner piece from my second problem) don't get wiped, and some debugging text and JLabels (in a different JPanel) are fine. I don't think the JPanel matters though; the border pieces and the playing squares (which get wiped) are in the same JPanel and same array of squares.
    repaint(); also erases ALL of my playing squares, whereas moving a window over them would only erase the part that the window covered.
    Also, I added a mouseListener so that whenever I move the mouse over a square, it changes the image (to a tinted version, so you know the mouse is over it) and when you move the mouse away, it returns to normal. However, if I wildly swing the mouse around the area, it seems to lock up and freeze for a few seconds. Is there anything I can do to prevent this??
    Thanks in advance.

    It is hard to tell what your problems are without any code at all (I saw your images, but that doesn't make it easy to see what is wrong in your code). If you do post code, please use code tags (see button above posting box).
    I've seen your MouseListener problem before--we had the exact same issue in our code at work. It would freeze up while it processed all of the mouse events (unbearably slow). I'm not at work right now, so I don't recall how it was fixed. Essentially, you need to only process the event periodically. You need to only update the image if the mouse switches squares. Or, only update the image if the distance from the last mouse event is more than some specified amount. We might also have checked the time difference between mouse events before processing a new one. I could look at the code at work tomorrow, if you are still having trouble.

  • Unable to set imageicon to JLabel

    hi
    I have base64 encoded image data, i am decoding this and trying to create an image icon object by passing decoded byte array.
    I am using apaches codec commons for base64 encoding and decoding.
    i have base64 converted tried with this code, but failing to display
    public class Display extends JFrame {
         public Display(String theImageData) {
              byte[] byteimage = Base64.decodeBase64(theImageData.getBytes());
              JLabel image = new JLabel();     
              getContentPane().setLayout(new BorderLayout());
              ImageIcon icon = new ImageIcon(byteimage);
              image.setIcon(icon);
              getContentPane().add(image, Borderlayout.CENTER);
    }when the window is displayed, the label doesn't display the image on it.
    thanks

    First, have you written code that verifies that when you encode and then decode the image data, the result is a byte-by-byte equivalent byte[]?
    Second, have you checked to see what your ImageIcon can tell you about it's image loading:
    int status = icon.getImageLoadStatus();

  • Having problems setting text to a JLabel!!

    HI *.*,
    i'm having problems setting text to a JLabel.
    i have a JFrame with a JPanels and on the JPanel i have a JLabel.
    I have a text field wihich is used to input text.
    So, i'm using textField.getText() to read the text of the text field and setText() to write it to the Label.
    but setText() isn't displaying the text on the label.
    I'm using NetBeans as an ide
    Does anyone have any ideas??

    Here is some code
    public class AddClass extends JFrame implements ActionListener{
        public AddClass() {
            initComponents();
        }//end of 1st constructor with initComp
        //initComponents
        private void initComponents() {
            getContentPane().setLayout(new java.awt.GridLayout(3, 1));
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            prodPanel.setLayout(new java.awt.GridLayout(1, 3));
            prodPanel.setBackground(new java.awt.Color(255, 255, 255));
            prodPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Production", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 1, 12)));
            westPanel.setLayout(new java.awt.GridLayout(6, 0));
            westPanel.setBackground(new java.awt.Color(255, 255, 255));
            westPanel.add(westLab1);
            westLab2.setBackground(new java.awt.Color(255, 255, 255));
            westLab2.setFont(new java.awt.Font("Arial", 1, 36));
            westLab2.setForeground(new java.awt.Color(0, 204, 0));
            westLab2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
            westLab2.setIcon(new javax.swing.ImageIcon("C:\\icontexto-webdev-bullet-048x048.png"));
            westLab2.setText("MQ 35");
            westLab2.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);
            westLab2.setIconTextGap(10);
            westLab2.setInheritsPopupMenu(false);
            westPanel.add(westLab2);
            westPanel.add(westLab3);
            westPanel.add(westLab4);
            westPanel.add(westLab5);
            prodPanel.add(westPanel);
            setJMenuBar(menuBar);
            setTitle("Broker Monitor");
            this.setSize(700, 700);
            BrokerWindowCloser brkWindowCloser = new BrokerWindowCloser();
            this.addWindowListener(brkWindowCloser);
            pack();
            //       setVisible(true);
        }//end of initComponents
        public AddClass(String st) {
            initComponents();
            westLab6.setVisible(true);
    //        System.out.println("in broker  " + st); 
            westLab6.setText(st);
            System.out.println(st);
            westLab6.setBackground(new java.awt.Color(255, 255, 255));
            westLab6.setFont(new java.awt.Font("Arial", 1, 36));
            westLab6.setForeground(new java.awt.Color(0, 204, 0));
            westLab6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
            westLab6.setIcon(new javax.swing.ImageIcon("C:\\PNG\\icontexto-webdev-bullet-048x048.png"));
            westLab6.setEnabled(true);
            westLab6.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);
            westLab6.setIconTextGap(15);
            westLab6.setInheritsPopupMenu(false);
            westPanel.add(westLab6);
    //       this.validate();
            westPanel.repaint();
        public void actionPerformed(ActionEvent ae) {
            Object source = ae.getSource();
            if(source == exitMI) {
                System.exit(0);
            }//end of if exitMI
            if(source == addMI){
                new AddMQ_1_1();
            if(source == removeMI){
                new RemoveMQ_1();
        }//end of actionPerformed
        class BrokerWindowCloser extends WindowAdapter {
            public void windowClosing(WindowEvent we) {
        }//end of windowcloserclass
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new AddClass().setVisible(true);
        }//end of main
    }// End of variables declaration
       public void addButtonActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
            Object source = evt.getSource();
            if(source == addButton){
                System.out.println("here");
                String st = mqNameJTF.getText();
                Broker1 br = new Broker1(st);
                AddClass adc = new AddClass(st);
                this.repaint();
    this.dispose();
            }//end of if addButton
        }//end addButtonActionPerformed

  • Problems setting up username & password for SQL

    Due to the outstanding advice I recieved from this excellent forum, I have managed to overcome my first problem with declaring a new Class.
    This leads me to request help with my next biggest problem:
    Setting up a user GUI that takes a "username" & "password" that will be used to access a password protected database.
    I am a simple bloke, with simple thought processes, so please, go easy on me...
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.sql.*;
    public class DBQuery1 {
         String username = "" , password = "";
         public static void main(String[] arguments) {
              PassDB UPass = new PassDB();
              String data = "jdbc:odbc:JavaTestDataBase";
              try {
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   Connection conn = DriverManager.getConnection(data, "" + username, "" + password);
                   Statement st = conn.createStatement();
                   ResultSet rec = st.executeQuery(
                        "SELECT Title, ContactID, First, Last, Dear FROM Contacts "
                        + "WHERE (Title='Mr') ORDER BY ContactID");
              /*     ResultSet rec2 = st.executeQuery(
                        "SELECT Subject, ContactID FROM Calls "
                        + "WHERE (Subject Is Not Null) ORDER BY ContactID");
              System.out.println("\nFirst Name\tSurname\t\tNick Name\t\tSubject\n");
              while(rec.next()) {
                   System.out.println(rec.getString(3) + "\t\t" + rec.getString(4) + "\t\t" + rec.getString(5) /* + rec2.getString(1) */ );
              st.close();
              catch (SQLException s) {
                   System.out.println("SQL Error: " + s.toString() + " " + s.getErrorCode() + " " + s.getSQLState());
              catch (Exception e) {
                   System.out.println("Error: " + e.toString() + e.getMessage());
    class PassDB extends javax.swing.JFrame implements ActionListener {
         String username = "", password = "";
         JTextField uname = new JTextField(10);
         JTextField pword = new JTextField(10);
         // JPasswordField pword = new JTextField(10);
         PassDB() {
              super("duBe's database logon");
              setSize(220, 160);
              setDefaultCloseOperation(EXIT_ON_CLOSE);
              JPanel pane = new JPanel();
              JLabel unameLabel = new JLabel ("Username: ");
              JLabel pwordLabel = new JLabel ("Password: ");
              JButton submit = new JButton("OK");
              submit.addActionListener(this);
              pane.add(unameLabel);
              pane.add(uname);
              pane.add(pwordLabel);
              pane.add(pword);
              pane.add(submit);
              setContentPane(pane);
              setVisible(true);
         public void actionPerformed(ActionEvent evt) {
              PassDB clicked = (PassDB)evt.getSource();
              username = uname.getText();
              password = pword.getText();
    This code generates two errors, stating:
    C:\Java_progs>javac DBQuery1.java
    DBQuery1.java:14: non-static variable username cannot be referenced from a static context
    Connection conn = DriverManager.getConnection(data, "" +
    username, "" + password);
    ^
    DBQuery1.java:14: non-static variable password cannot be referenced from a static context
    Connection conn = DriverManager.getConnection(data, "" +
    username, "" + password);
                    ^
    2 errors*****************************
    The code works when I remove the reference to the variables "username" & "password" in Connection "conn" call & replace them with the actual username & password, but this is not exactly what I was after. I was hoping to make the program responsive to each individual user, not set in code.
    I also would like to make the program pause after the call in "main" to "PassDB" to wait for "PassDB" to exit before continuing.
    I would also like to make "PassDB" destroy itself after the "OK" button is pressed & the "username" & "password" set.
    If that isn't enough for you, I would really like the program to search 2 different database tables, return their values & compare them to be sure that they are the same.
    When I try & search 2 different tables, as in:
    ResultSet rec = st.executeQuery(
                        "SELECT Title, ContactID, First, Last, Dear FROM Contacts "
                        + "WHERE (Title='Mr') ORDER BY ContactID");
                   ResultSet rec2 = st.executeQuery(
                        "SELECT Subject, ContactID FROM Calls "
                        + "WHERE (Subject Is Not Null) ORDER BY ContactID")javac tells me that "ResultSet" is set to null 0
    As always, I am extremely appreciative of any assistance you are able to offer.
    Kind regards
    duBedat
    [email protected]

    This is where I'm at now:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.sql.*;
    public class DBQuery {
         static String username = "" ;
         static String password = "" ;
         public static void main(String[] arguments) {
         PassDB UPass = new PassDB();
         String data = "jdbc:odbc:JavaTestDataBase";
         try {
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              Connection conn = DriverManager.getConnection(data, "" + DBQuery.username, "" + DBQuery.password);
              Statement st = conn.createStatement();
              ResultSet rec = st.executeQuery(
              "SELECT Title, ContactID, First, Last, Dear FROM Contacts "
              + "WHERE (Title='Mr') ORDER BY ContactID");
              /*     ResultSet rec2 = st.executeQuery(
                   "SELECT Subject, ContactID FROM Calls "
                   + "WHERE (Subject Is Not Null) ORDER BY ContactID");
              System.out.println("\nFirst Name\tSurname\t\tNick Name\t\tSubject\n");
              while(rec.next()) {
                   System.out.println(rec.getString(3) + "\t\t" + rec.getString(4) + "\t\t" + rec.getString(5) /* + rec2.getString(1) */ );
              st.close();
         catch (SQLException s) {
              System.out.println("SQL Error: " + s.toString() + " " + s.getErrorCode() + " " + s.getSQLState());
         catch (Exception e) {
              System.out.println("Error: " + e.toString() + e.getMessage());
    class PassDB extends javax.swing.JFrame implements ActionListener {
         static boolean getOut = false;
         JTextField uname = new JTextField(10);
         JTextField pword = new JTextField(10);
         // JPasswordField pword = new JTextField(10);
         public PassDB() {
              super("duBe's database logon");
              setSize(220, 160);
              setDefaultCloseOperation(EXIT_ON_CLOSE);
              JPanel pane = new JPanel();          
              JLabel unameLabel = new JLabel ("Username: ");
              JLabel pwordLabel = new JLabel ("Password: ");
              JButton submit = new JButton("OK");
              submit.addActionListener(this);
              pane.add(unameLabel);
              pane.add(uname);
              pane.add(pwordLabel);
              pane.add(pword);
              pane.add(submit);
              setContentPane(pane);
              while(getOut == false)
                   setVisible(true);                         
         public void actionPerformed(ActionEvent evt) {
              PassDB clicked = (PassDB)evt.getSource();
              DBQuery.username = uname.getText();
              DBQuery.password = pword.getText();
              getOut = true;               
    }          Any advice is greatly appreciated
    duBe

  • Problems setting up MPLS

    A Chairde,
    Am having problems setting up MPLS between a AS5350 and 7609 , I have used commands stated in this link, enable MPLS incrementally on a network.
    http://www.cisco.com/univercd/cc/td/doc/product/software/ios121/121cgcr/switch_c/xcprt4/xcdtagc.pdf
    The commands below are added to each router, and some troubleshooting.
    7609
    ip cef distributed
    interface Loopback0
    ip address 192.168.254.1 255.255.255.255
    tag-switching advertise-tags
    interface GigabitEthernet3/12
    ip address 192.168.230.162 255.255.255.248
    mpls label protocol tdp
    tag-switching ip
    AS5350
    ip cef
    mpls label protocol tdp
    tag-switching advertise-tags
    interface Loopback0
    ip address 192.168.254.2 255.255.255.255
    interface FastEthernet0/0
    ip address 192.168.230.161 255.255.255.248
    duplex auto
    speed auto
    mpls ip
    h323-gateway voip interface
    h323-gateway voip id cnibhco111 ipaddr 192.168.230.129 1719
    h323-gateway voip h323-id cnibhco112
    h323-gateway voip tech-prefix 71401
    h323-gateway voip tech-prefix 0030
    h323-gateway voip bind srcaddr 192.168.230.161
    ip rsvp bandwidth 64 64
    cnibhco112#sh tag-switching tdp neighbor
    Peer TDP Ident: 192.168.254.1:0; Local TDP Ident 192.168.230.161:0
    TCP connection: 192.168.254.1.49842 - 192.168.230.161.711
    State: Oper; PIEs sent/rcvd: 18/23; Downstream
    Up time: 00:12:54
    TDP discovery sources:
    FastEthernet0/0, Src IP addr: 192.168.230.162
    Addresses bound to peer TDP Ident:
    192.168.100.17 192.168.100.25 159.107.212.49 172.16.8.81
    192.168.230.130 192.168.230.77 192.168.230.81 192.168.254.1
    192.168.210.6 192.168.127.6 192.168.210.106 192.168.127.66
    192.168.127.138 192.168.210.146 192.168.210.142 192.168.210.122
    192.168.210.17 192.168.230.140 192.168.230.26 192.168.230.74
    192.168.230.10 192.168.230.14 192.168.127.130 192.168.127.142
    192.168.230.6 192.168.230.70 192.168.230.34 192.168.210.178
    192.168.200.25 192.168.210.126 192.168.232.1 192.168.231.1
    192.168.200.17 192.168.210.102 190.168.200.245 190.168.200.225
    190.168.201.241 192.168.230.98 192.168.210.14 190.168.201.201
    190.168.201.209 192.168.210.162 192.168.210.210 190.168.201.205
    192.168.230.38 190.168.200.249 190.168.200.217 190.168.200.253
    192.168.230.162
    cnibhco112#
    cnibhco112#sh tag-switching forwarding-table 192.168.254.1 detail
    Local Outgoing Prefix Bytes tag Outgoing Next Hop
    tag tag or VC or Tunnel Id switched interface
    cnibhco112#traceroute 192.168.254.1
    Type escape sequence to abort.
    Tracing the route to 192.168.254.1
    1 192.168.230.162 0 msec 0 msec *
    cnibhco112#traceroute 192.168.230.162
    Type escape sequence to abort.
    Tracing the route to 192.168.230.162
    1 192.168.230.162 0 msec 0 msec *
    cnibhco112#

    Ro,
    Thanks for the respone, have been playin, with MPLS for last few hours.
    The routing between the loopbacks is now working, can PING 7609 Loopback from AS5350 ,and vice versa. (used static routes).
    Having problem with TDP / LDP on routers,
    mpls label protocol ldp / tdp command works correctly on both routers, but the
    tag-switching tdp router-id Loopback0 force
    command works on the 7609, but when I add it onto the AS5350 , the command "mpls ldp router-id Loopback0 force" appears on the startup script.
    The opposite is true for the 7609 , you add MPLS LDP command, and TAG-SWITCHING command appears instead.
    Any Ideas, as different configs of this leave me with forwarding table with both tags added, but not been able to ping the loopbacks !!!
    When I can ping bot loopbacks, the OUTGOING TAG , disapears.....
    Problem is LOOPBACK Commands on bot routers default to LDP (AS5350) , or TDP (7609). Any Ideas ...
    mpls label protocol tdp
    tag-switching tdp router-id Loopback0 force
    mpls label protocol tdp
    mpls ldp router-id Loopback0 force
    cnibhco100#sh tag-switching forwarding-table 192.168.254.2 detail
    Local Outgoing Prefix Bytes tag Outgoing Next Ho
    tag tag or VC or Tunnel Id switched interface
    18 17 192.168.254.0/24 0 Gi3/12 192.168.2
    MAC/Encaps=14/18, MRU=1500, Tag Stack{17}
    00097CA3293000127FCDBA808847 00011000
    No output feature configured
    Per-packet load-sharing
    cnibhco100#traceroute 192.168.254.2
    Type escape sequence to abort.
    Tracing the route to 192.168.254.2
    1 192.168.230.161 [MPLS: Label 17 Exp 0] 0 msec 0 msec 0 msec
    2 192.168.230.162 0 msec 0 msec 0 msec
    But no PINGING 192.168.254.2
    cnibhco112#sh tag-switching forwarding-table 192.168.254.1 detail
    Local Outgoing Prefix Bytes tag Outgoing Next Hop
    tag tag or VC or Tunnel Id switched interface
    17 18 192.168.254.0/24 1915668 Fa0/0 192.168.230.162
    MAC/Encaps=14/18, MRU=1500, Tag Stack{18}
    00127FCDBA8000097CA329308847 00012000
    No output feature configured
    Per-packet load-sharing
    cnibhco100#sh tag-switching forwarding-table 192.168.254.2 detail
    Local Outgoing Prefix Bytes tag Outgoing Next Ho
    tag tag or VC or Tunnel Id switched interface
    18 17 192.168.254.0/24 752551 Gi3/12 192.168.2
    MAC/Encaps=14/18, MRU=1500, Tag Stack{17}
    00097CA3293000127FCDBA808847 00011000
    No output feature configured
    Per-packet load-sharing
    WHEN BOTH LOCAL AND OUTGOING TAG, CANNOT PING EITHER WAY !!!
    HAVE LABEL PROTOCOL AND LOOPBACK FORCE on AS5350
    HAVE LABEL PROTOCOL ON 7609
    WHEN ADD LOOPBACK FORCE on 7609 , CAN PING BOTH LOOPBACKS,
    BUT OUTGOING TAG DISAPEARS
    cnibhco112#PING 192.168.254.2
    Type escape sequence to abort.
    Sending 5, 100-byte ICMP Echos to 192.168.254.2, timeout is 2 seconds:
    Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
    cnibhco112#sh tag-switching forwarding-table 192.168.254.1 detail
    Local Outgoing Prefix Bytes tag Outgoing Next Hop
    tag tag or VC or Tunnel Id switched interface
    17 Untagged 192.168.254.0/24 598678 Fa0/0 192.168.230.162
    MAC/Encaps=0/0, MRU=1504, Tag Stack{}
    No output feature configured
    Per-packet load-sharing
    cnibhco112#
    mpls label protocol tdp
    tag-switching tdp router-id Loopback0 force

  • Problems use ImageIcon

    I am having a problem using ImageIcon. I can see the images in
    the AppletViewer, but not in an actual Applet. I get a NullPointer
    Exception. It seems to be a problem with the Class or ClassPath finding the image.
    Here is a break down of my files and the packages they are in:
    mygui/gui/project -> contains the java project file
    mygui/gui -> contains the gui.jar (created)
    mygui/gui/guiFramework -> contains MyApplet.java (extends JApplet) and
    MyWindow.java (extends JFrame)
    mygui/gui/images -> contains image mypicture.gif
    MyWindow references the images found in mygui/gui/images
    Here is the code from MyWindow:
    package guiFramework;
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    public class MyWindow extends JFrame {
    private static Container content;
    private ImageIcon myIcon = new
    ImageIcon(ClassLoader.getSystemResource("images/mypicture.gif"));
    private Image myImage = myIcon.getImage();
    public MyWindow()
    super("My Sample");
    super.setIconImage(myImage);
    super.setDefaultCloseOperation(/*DISPOSE_ON_CLOSE*/3);
    JButton iconButton = new JButton();
    ImageIcon buttonIcon = new
    ImageIcon(ClassLoader.getSystemResource("images/mypicture.gif"));
    //Set the container as "this"
    content = getContentPane();
    iconButton.setIcon(buttonIcon);
    content.add(iconButton, BorderLayout.CENTER);
    setSize(1024, 768);
    setVisible(true);
    Here is the code from MyApplet:
    package guiFramework;
    import javax.swing.*;
    import java.awt.*;
    public class MyApplet extends JApplet
    public MyApplet()
    try
    UIManager.setLookAndFeel(new com.sun.java.swing.plaf.windows.
    WindowsLookAndFeel());
    catch (Exception e)
    MyWindow myWindow = new MyWindow();
    public void init()
    getRootPane().putClientProperty("defeatSystemEventQueueCheck",
    Boolean.TRUE);
    Any help would be greatly appreciated. The code above is from a
    sample I have put together to try to figure out what the problem is.
    It is not my actual program (which is very big). It does reproduce the
    problem though.
    - M

    MyWindow.getClass().getResource(..); is not a function of JFrame.
    If I try MyWindow.class.getResource("images/mypicture.gif"); I can no longer see the image even in the AppletViewer.
    java.lang.NullPointerException
         at javax.swing.ImageIcon.<init>(ImageIcon.java:134)
         at guiFramework.MyWindow.<init>(MyWindow.java:10)
         at guiFramework.MyApplet.<init>(MyApplet.java:19)
         at java.lang.Class.newInstance0(Native Method)
         at java.lang.Class.newInstance(Class.java:237)
         at sun.applet.AppletPanel.createApplet(AppletPanel.java:579)
         at sun.applet.AppletPanel.runLoader(AppletPanel.java:515)
         at sun.applet.AppletPanel.run(AppletPanel.java:293)
         at java.lang.Thread.run(Thread.java:484)
    I am using a JAR file to hold all the information, but my images are in a subdirectory. I think I am still not looking in the correct place for the images?

  • Problems setting up an NFS server

    Hi everybody,
    I just completed my first arch install. :-)
    I have a desktop and a laptop, and I installed Arch on the desktop (the laptop runs Ubuntu 9.10). I had a few difficulties here and there, but I now have the system up and running, and I'm very happy.
    I have a problem setting up an NFS server. With Ubuntu everything was working, so I'm assuming that the Ubuntu machine (client) is set-up correctly. I'm trying to troubleshoot the arch box (server) now.
    I followed this wiki article: http://wiki.archlinux.org/index.php/Nfs
    Now, I have these problems:
    - when I start the daemons, I get:
    [root@myhost ~]# /etc/rc.d/rpcbind start
    :: Starting rpcbind [FAIL]
    [root@myhost ~]# /etc/rc.d/nfs-common start
    :: Starting rpc.statd daemon [FAIL]
    [root@myhost ~]# /etc/rc.d/nfs-server start
    :: Mounting nfsd filesystem [DONE]
    :: Exporting all directories [BUSY] exportfs: /etc/exports [3]: Neither 'subtree_check' or 'no_subtree_check' specified for export "192.168.1.1/24:/home".
    Assuming default behaviour ('no_subtree_check').
    NOTE: this default has changed since nfs-utils version 1.0.x
    [DONE]
    :: Starting rpc.nfsd daemon [FAIL]
    - If I mount the share on the client with "sudo mount 192.168.1.20:/home /media/desktop", IT IS mounted but I can't browse it because I have no privileges to access the home directory for the user.
    my /etc/exports looks like this:
    # /etc/exports: the access control list for filesystems which may be exported
    # to NFS clients. See exports(5).
    /home 192.168.1.1/24(rw,sync,all_squash,anonuid=99,anongid=99))
    /etc/conf.d/nfs-common.conf:
    # Parameters to be passed to nfs-common (nfs clients & server) init script.
    # If you do not set values for the NEED_ options, they will be attempted
    # autodetected; this should be sufficient for most people. Valid alternatives
    # for the NEED_ options are "yes" and "no".
    # Do you want to start the statd daemon? It is not needed for NFSv4.
    NEED_STATD=
    # Options to pass to rpc.statd.
    # See rpc.statd(8) for more details.
    # N.B. statd normally runs on both client and server, and run-time
    # options should be specified accordingly. Specifically, the Arch
    # NFS init scripts require the --no-notify flag on the server,
    # but not on the client e.g.
    # STATD_OPTS="--no-notify -p 32765 -o 32766" -> server
    # STATD_OPTS="-p 32765 -o 32766" -> client
    STATD_OPTS="--no-notify"
    # Options to pass to sm-notify
    # e.g. SMNOTIFY_OPTS="-p 32764"
    SMNOTIFY_OPTS=""
    # Do you want to start the idmapd daemon? It is only needed for NFSv4.
    NEED_IDMAPD=
    # Options to pass to rpc.idmapd.
    # See rpc.idmapd(8) for more details.
    IDMAPD_OPTS=
    # Do you want to start the gssd daemon? It is required for Kerberos mounts.
    NEED_GSSD=
    # Options to pass to rpc.gssd.
    # See rpc.gssd(8) for more details.
    GSSD_OPTS=
    # Where to mount rpc_pipefs filesystem; the default is "/var/lib/nfs/rpc_pipefs".
    PIPEFS_MOUNTPOINT=
    # Options used to mount rpc_pipefs filesystem; the default is "defaults".
    PIPEFS_MOUNTOPTS=
    /etc/hosts.allow:
    nfsd: 192.168.1.0/255.255.255.0
    rpcbind: 192.168.1.0/255.255.255.0
    mountd: 192.168.1.0/255.255.255.0
    Any help would be very appreciated!

    Thanks, I finally got it working.
    I realized that even though both machines had the same group, my Ubuntu machine (client) group has GID 1000, while the Arch one has GID 1001. I created a group that has GID 1001 on the client, and now everything is working.
    I'm wondering why my Arch username and group both have 1001 rather than 1000 (which I suppose would be the default number for the first user created).
    Anyway, thanks again for your inputs.

  • Problems setting up static routing

    HI
    I'm having a problem setting up static routing.  I keep getting the message "invalid static route".   I have an E1550 router and my frimware is up to date.  I have tried a few different gateway addresses ie 192.168.1.1,  127.0.0.1 and my router's address on the net, but I keep getting the same message.  Has anyone else had this problem and been able to fix it?

    I think the E1550 router supports LAN to LAN routing provided that you have two local networks. If you only have a plain modem and the E1550, I believe you can't do Static routing on that type of setup. Found this link that might help: http://kb.linksys.com/Linksys/ukp.aspx?vw=1&docid=12a84336a124498eb5d6f0204b85191e_17589.xml&pid=80&...

  • Problems Setting Up Developer Users

    I am having a problem setting up developer users and I am trying to determine if I am missing a step or if there is a configuration problem on my staging and production systems.
    What I want to do should be very simple. I want to create a user that can create an application and see the information under the "Application" tab in the Navigator.
    I have created the user using the following steps on 3.0.9.82 for Unix:
    1. Create the user
    2. Make the user a full administrator (rather than end user)
    3. Make the user a member of the portal_developers group
    4. Make the user's default group the portal_developers group
    However, when I do this the user does not see the information under the
    "Application" tab. The only way I can get the user to see the info under the
    "Application" tab is to make him a member of the Portal_administrators
    and/or DBA group. Both my staging and production boxes have the same result.
    Does anyone have any thoughts or suggestions on what might be happening?

    Thank you- I have read through that thread and can see some resonance with my issue.
    My AOL emails work VERY fast with BB, in fact almost simultaneously received on PC & Torch " ping ping!"
    This issue only raised its ugly head when I had 2 Torches replaced by my insurers. 
    Whilst the claim was in process I used a new Curve, loaded from backup on PC to keep emails going and of course phone & web facilities. ( I use the BB to power internet via bluetooth to my PC / laptop when living on a remote island with no phone lines or power supplies)  All was fine. Swapping email accounts took a few minutes with the usual password confirmations for each AOL screenname etc. 
    Then the new Torches came back from insurers, and I tried to swap devices. Phoning & texting is fine. Al data and contacts swap over fine.
    SETUP email accounts.............stymied every time. It says repeatedly that my user name/password is invalid etc etc etc
    Have tried security wipes. Have tried setting up new BB ID & passwords on PC website. All is OK until I try to setup emails on the Torches.  This has used up ridiculous amounts of time- all wasted.
    I love the BB phones and the fast email push......in fact I recently bought a new Sony Xperia Z1 but sent it back because of wifi coverage meant no emails on that superb phone for lots of the time.
    Good old BB I said..........I always get emails wherever I am. ( Rural Scotland has very patchy radio & wifi coverage)  
    Was about to purchase new Z10s just to get a bigger screen, but now I am averse to buying ANY BB phone again because this present mess means I may never get emails set up again.  How nuts is that?
    Many thanks for all help & suggestions..........boy do I need them!!
    Kind wishes from West of Scotland 
    Fair winds and kind landfalls

  • Problems setting up VVSA 6.0 (lookup service adresse)

    Hi,
    I was happy to see VVSA 6.0 released, but i'm having problems setting it up. It keeps saying that the lookup service adresse is not reachable. But I have tried with the VVSA 5.5 and 5.5.1.1 and they work just fine with the lookup service adresse.
    Anyone else having this issue?
    Also trying to check for updates within the appliance failes since the repository is not online at vmware it seems.
    Might not be ready for primetime (like ESXi6).

    If Developer has a separate Oracle Home on your PC, then it has a separate TNSNAMES.ORA file that is uses to connect to the database. If you search for all tnsnames.ora files, you should find the one used by Developer 6.
    Since Enterprise manager works, the tnsnames.ora in your Enterprise Manager's home will have an entry for your server database. You should be able to cut and paste this into the tnsnames.ora file used by Developer, or try copying the E.M. tnsnames.ora file directly.
    John Alexander www.SummitSoftwareDesign.com

  • Problems setting up JDBC

    I recently downloaded mysql Connector for my project.
    However, I have problems setting it up.
    When I run my program, It gives me a class not defined error.
    System.out.println("Registering Driver...");
                   Class.forName("com.mysql.jdbc.Driver").newInstance();
    System.out.println("Connected to database");
    System.out.println("Creating Connection");
    connection= DriverManager.getConnection("jdbc:mysql://localhost:8080/neuis");
    System.out.println("Connection created");
    catch(Exception ex)
    System.out.println("Error in loading jdbc Driver: "+ex);
    ex.printStackTrace();
    I have put the jar file of the JDBC Bridge in a folder
    C:\Drivers\Sql Connector
    I have also added the absolute path of the jar to the system classpath
    The value put in is:
    C:\Drivers\Sql Connector\mysql-connector-java-3.1.10-bin.jar.
    I am not sure what the problem is because I was told by the API that this was all I needed to do. Are there any other files I need to include with the jar file? Also, Is there a specific folder I must put it in?
    Thank you in advance.

    Hi,
    Take a look at the below link
    http://www.cs.nott.ac.uk/TSG/manuals/databases/mysql/jdbc.html
    may help you to setting up the jdbc with mysql
    regards
    MJ

  • Problems setting up email account

    Have recently got a blackberry 9300 and having problems setting up my aol email account. 
    Do not know how to fix this problem, can anyone please give advice?

    Hi and Welcome to the Forums!
    Well, a bit more detail than "having problems" might help us just a bit...keep us from guessing, after all. In the meantime, see this:
    http://us.blackberry.com/support/blackberry101/set​up.jsp#tab_tab_email
    Good luck and let us know!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Problems Setting up my wireless network with an Xb...

    Hi, I have had some problems setting up my wireless networking.
    I have everything switched on and am able to go online with the laptop and the Xbox with no problems but when I try to share media with the xbox I have problems.
    I have opened the ports specified in the setup from xbox on windows firewall and have no problem connection Via Ethernet cable but when using wireless the xbox cannot detect the laptop.
    I have checked the network map and both xbox and laptop are connected and have enabled sharing and am running sharing software.
    Below is the network map.
    I have also been having problems with BT software, the free virus protection will not install, The desktop help will not launch although it shows up on task manager and the installation disk does not launch correctly it doesn't get past the loading screen.
    I have had a printer on the wireless network and had no problems printing.
    If anyone knows how to resolve this please help.

    I have this same Motorola modem and I just verified that my 802.11n AirPort Express Base Station (AXn) can get Internet access with this modem without any issues.
    When changing ISPs (or networking equipment) it's always a good idea to start from "scratch" in configuring your equipment.
    I would recommend that you do the following as a minimum:
    Power-down the modem, AirPort base station, and computer(s).
    While all of the devices are powered-down, perform a "factory default" reset on the base station. This will get it back to its "out-of-the-box" configuration and make setting it up much easier, especially if you use the "Assist me" process within the AirPort Utility. (ref: Resetting an AirPort Base Station or Time Capsule)
    After the base station resets, go ahead and power it back down.
    Power-up the modem; wait at least 10-15 minutes.
    Power-up the base station; wait at least 5-10 minutes.
    Power-up your computer(s).
    In this basic configuration, computers connected to the base station, either by wire or wireless (as appropriate for the base station type), should now be able to access the Internet through the ISP's modem. Once Internet connectivity has been verified, you can use the AirPort Utility to configure the base station for wireless security and any other desired options.

  • Problems Setting up NFS

    Hi.
    I've been having problems setting up NFS on a LAN at home.  I've read through all the Arch NFS-related threads and looked at (and tried some of) the suggestions, but without success.
    What I'm trying to do is set up an NFS share on a wireless laptop to copy one user's files from the laptop to a wired workstation.  The laptop is running Libranet 2.8.1. The workstation is running Arch Linux with the most up-to-date (as of today) software, including NFS.
    I have the portmap, nfslock, and nfsd daemons running via rc.conf, set to run in that order.
    I've re-installed nfs-utils and set up hosts.deny as follows:
    # /etc/hosts.deny
    ALL: ALL
    # End of file
    and hosts.allow as follows:
    # /etc/hosts.allow
    ALL: 192.168.0.0/255.255.255.0
    ALL: LOCAL
    # End of file
    In other words, I want to allow access on the machine to anything running locally or on the LAN.
    I have the shared directories successfully exported from the laptop (192.168.0.3), but I have not been able to mount the exported directories on the workstation (192.168.0.2).
    The mount command I'm using at the workstation:
    mount -t nfs -o rsize=8192,wsize=8192 192.168.0.3:/exports /exports
    There is an /exports directory on both machines at root with root permissions. There is an /etc/exports file on the NFS server machine that gives asynchronous read/write permissions to 192.168.0.2 for the /exports directory.
    I receive the following message:
    mount: RPC: Program not registered
    This appears to be a hosts.allow/hosts.deny type problem, but I can't figure out what I need to do to make RPC work properly.
    Some additional information, just in case it's helpful:
    This is the result if running rpcinfo:
       program vers proto   port
        100000    2   tcp    111  portmapper
        100000    2   udp    111  portmapper
        100024    1   udp  32790  status
        100024    1   tcp  32835  status
        100003    2   udp   2049  nfs
        100003    3   udp   2049  nfs
        100003    4   udp   2049  nfs
        100003    2   tcp   2049  nfs
        100003    3   tcp   2049  nfs
        100003    4   tcp   2049  nfs
        100021    1   udp  32801  nlockmgr
        100021    3   udp  32801  nlockmgr
        100021    4   udp  32801  nlockmgr
        100021    1   tcp  32849  nlockmgr
        100021    3   tcp  32849  nlockmgr
        100021    4   tcp  32849  nlockmgr
        100005    3   udp    623  mountd
        100005    3   tcp    626  mountd
    Running ps shows that the following processes are running:
    portmap
    rpc.statd
    nfsd
    lockd
    rpciod
    rpc.mountd
    Thanks for any help here!
    Regards,
    Win

    Hi ravster.
    Thanks for the suggestions. I had read the Arch NFS HowTo and did as you suggested get rcpinfo for the server machine. The Libranet NFS server is configured rather different since the NFS daemons are built into the default kernel.
    Since I needed to complete the transfer immediately, I gave up for now trying to set up NFS and used netcat (!) instead to transfer the files from the Libranet laptop to the Arch workstation. The laptop will be converted to Arch Linux soon so I think I'll be able to clear things up soon.  I haven't had any problems setting up NFS with homogeneous (i.e., all Arch or all Libranet) computer combinations.
    Thanks again.
    Win

Maybe you are looking for

  • Can't register IPOD Classic

    Everyone, this sounds really easy. I had a nano previously and it was easy. I just plug it in and the screen comes up and it charges and syncs. Well, I lost it and my wife got me an Ipod Classic. I'm doing the same thing, I plug it in, but no screen

  • Can't log in after recovery from time machine

    We had to replace the disk on my daughter's MacBook Pro. We restored her data from Time Machine on an external drive. After completion the system brought up the login screen. In addition to her account, there's one for me and one for my wife. All of

  • TS4002 I have a spreadsheet or PDF file that I cannot get rid of on my email.  How do I get this off my screen. I have tried everything.

    I am trying to read my email.  I opened a PDF file and now I can't get back to my emails.

  • Regd: Drop down option related

    hi gurus, am Created  an iView with a  drop down selection option. for example <b>Display as : Table                 : Chart</b> it's working fine and displaying in the output as per the selection in the Drop down list. my Question is it's working in

  • SWWDHEX Cancelled

    Hi Everyone, All instances of the Job SWWDHEX are being shown as cancelled in the background job log (SM37). On checking the job log, I found that the report RSWWDHEX is causing dump in the system. The job log shows: Job started Step 001 started (pro