Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7551013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:22:08+00:00 2026-05-30T10:22:08+00:00

im making a game server the login server is done, now im working on

  • 0

im making a game server the login server is done, now im working on the character server.

My problem is on the client, I recieve all the values and then I want to create a character based on those values. Here is my jPanel code.

public class createChar extends JPanel {
   private final int ID;
   private String user;
   private int level;
   private int exp;
   private float r;
   private float gr;
   private float b;

public createChar(String username,int ID,int level,int exp,float r,float g,float b){
    this.ID = ID;
    this.user = username;
    this.level = level;
    this.exp = exp;
    this.r =(int) r;
    this.gr =(int) g;
    this.b =(int) b;
    setVisible(true);
}


@Override
public void paintComponent(Graphics g){
    super.paintComponent(g);
    Color clr = new Color(r,gr,b);
    g.setColor(clr);
    g.fillRect(50, 50, 100, 100);   
 super.repaint();

}

Here I add the jPanel:

                           while((fChara = cin.readLine()) != null){
                           System.out.println("[CHARAS]" + fChara);
                          if (fChara.contains("-")){

                       Scanner cs = new Scanner(fChara);
                        cs.useDelimiter(":");

                          String schar = cs.next();



                       System.out.println( "schar:" +schar);

                      //   cs.delimiter();
                    int id = cs.nextInt();
                    String cname = cs.next();
                       System.out.println("ID:" + id);
                    int level = cs.nextInt();
                    int exp = cs.nextInt();
                    int r = cs.nextInt();
                    int g = cs.nextInt();
                    int b = cs.nextInt();

                    System.out.println( id +":" + cname+":" + level+":" + exp+":" + r+":" +g+":" +b);
                          createChar chara = new createChar(cname,id,level,exp,r,g,b);  
                       jPanel1.add(chara);

                       }

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T10:22:09+00:00Added an answer on May 30, 2026 at 10:22 am

    Have you noticed that there is no question in your question? Guessing: your panel is not displayed in parent container, is it? It is necessary to call container’s validate method after adding/removing components.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making a multiplayer networking game. Now to connect to the server, client
I'm working on a little client that interfaces with a game server. The server
I want to build a server/client engine for a game that I will eventually
I'm making a simple card game server in Java using eclipse. I'm now trying
With regards to making a game server, it seems Erlang always comes up as
I am making a game in JAVA where I want to come up with
I'm making a game. Now if my player goes to another level the music
I'm making a game and in the menu I want to display the text
I am making a game for Android and using Rails for server coding, and
Im making game plugin in java and Ive got problem with split function. index

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.