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 8423253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:40:35+00:00 2026-06-10T03:40:35+00:00

Tile Selection protected void myBox(ActionEvent evt) { if (patternList.getSelectedItem() != null) { System.out.println(patternList.getSelectedItem().toString()); getImagePath();

  • 0

Tile Selection

protected void myBox(ActionEvent evt) {
    if (patternList.getSelectedItem() != null) {
        System.out.println(patternList.getSelectedItem().toString());
        getImagePath();
    }

public String getImagePath(){
    jk = patternList.getSelectedItem().toString();
    System.out.println(jk);
    return jk;
}

Boxes

 public void TexDefine() throws SlickException, FileNotFoundException{
    TileSelection t = new TileSelection();
    Tex[171]= new Image(t.newSelection);
    textureCollecter();
}


    public int getN(int px, int oy){
    int n;
    if(p==0&&o==0){
        n = 0;
    }else if(p==0){
        n=oy*42;
    }else{
        n=(oy*42)+px;
    }
    return n;
}
if(in.isKeyPressed(Input.KEY_G)){
        TileSelection t = new TileSelection();
        System.out.println(t.jk);
        /*TexTileRenderer(getN(p, o), returnImagePth());*/
    }

I apologise it for bieng messy, but i’m new to slick and a amatuer at java but can you please enlighten me with you genuisness how the String jk when getting transfered between the classes are becoming null. Why is this?

P.S Im using slick and lwjgl libarys just a heads up. Its messy because i have been fiddling around with it and trying to find a solution.

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-06-10T03:40:36+00:00Added an answer on June 10, 2026 at 3:40 am
        TileSelection t = new TileSelection();
        System.out.println(t.jk);
    

    At this point if you haven’t selected a value/default value the selectedItem return null.

    Set a default selected item in your TileSelection constructor and also assign jk in the constructor after you assign a default selected item:

    patternList.setSelectedIndex(0);//sets first option in combobox to default value
    jk=(String) patternList.getSelectedItem();
    

    EDIT (This is also about the code before your edited the code for TileSelection out):

    Also note this is not a constructor:

    public void TileSelection(){
    }
    

    constructors do not use void keyword, thus calling TileSelection t = new TileSelection(); will not execute the method you want to create the frame and combobox etc so of course jk will be null either drop the void to make this a valid constructor or do:

    TileSelection t = new TileSelection().TileSelection(); 
    

    though I’d say use a constructor rather which will then make this:

    TileSelection t = new TileSelection();
    

    a valid call to creating a new instance of TileSelection.

    And if you followed the advice before my edit you can then:

    System.out.println(t.jk);
    

    Though it’s not good practice to expose instance variables as public, but that’s for another time. 🙂

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

Sidebar

Related Questions

I am trying to make a simple tile system for my game. I made
Say I am making a 2D Tile Based game in C# using System.Drawing for
The tile is exactly my question. [edited out mistaken code]
I have a tile system written in XNA, and there is problems with tiles
I have Tile s which represent the tiles in a game's 2-dimensional world. The
I am building a tile based app in Python using pyglet/openGL wherein I'll need
If I tile squares, and the squares can be defined by their coordinates, how
I would like to tile a CGImage across a CALayer, but it seems to
How to create a tile based game map in javafx 2.0? Should I use
I am able to display song tile fetched from local sd card.The issue is

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.