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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:46:04+00:00 2026-06-15T10:46:04+00:00

Here is the thing- my Main method only calls InitGui. Inside the whole class

  • 0

Here is the thing- my Main method only calls InitGui. Inside the whole class (basically the whole file, i have the InitGui method and a few public static gui objects. One of the objects is actuall an array

public static JButton Keys[] = null; 

And I have a method called placeKeys that gets the location for each JButton “Keys” and places it on the panel. The whole code works when I do not use this method, basically instead of for i=0 to whatever, I want just call placeKey(arguments here…) instead of
for each jButton to be placed like this

for i=0 to whatever
Keys[i] = new JButton(jBStringArray[i]);
        Keys[i].setLocation(2 + i*kSize,2+row*50);
        Keys[i].setSize(50, kSize);     
        keyboardPane.add(Keys[i]);            

I have the method written down but it reports a pointer error at the placeKeys when it tries to access the Keys[] , meaning the first line of the method

Hope you understood me

  • 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-15T10:46:05+00:00Added an answer on June 15, 2026 at 10:46 am

    Before your for loop (either when you declare it, or, if you rely on the null check, just before the for loop) you need to create the array with Keys = new JButton[whatever+1];. Oh and please start your variable names with a lowercase letter – it’s the universally-accepted thing to do.

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

Sidebar

Related Questions

I've been using Android ProgressBar quite a lot. The only thing here is for
Here is the thing. Right now I have this e-commerce web site where people
Here is the thing. I currently have a tabBar controller, with several navigation controllers
Here's the thing. I have an interface, and I would to put the Include
I have a class with a static method that looks roughly like: class X
I have a program that needs a class file written to make it run
I am trying to find out how method calls works in objective-c. I have
I have a question about this code right here public Car { public static
And what if you want to autocomplete passwords? I am using similar thing here...
Here's the thing. Recently I've tried to add FB like button to some website

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.