Stuck with a mini Java project, any insights much appreciated

Hello Community,

I am doing an apprenticeship as a Java developer and I am working with a mini Java project which creates a window with a JScrollPanel to display String which is programmed in the component class.

I already create two java class files (main and component). I am stuck with linking the component one to the main. This part of the code is from my main file:

private void initGUI(){

		    	jScrollPane1 = new JScrollPane();
				jScrollPane1.setBounds(31, 31, 300, 175);
					jListWolkenkrazer = new DefaultListModel();
					jListalcobareno = new JList();
				    skyscrapers = new SkyScrapers();
		    	jBShow = new JButton();
		    	jBShow.setBounds(174, 230, 94, 23);
		    	jBShow.addActionListener(new ActionListener() {
		    		public void actionPerformed(ActionEvent evt) {

private void jBShowActionPerformed(ActionEvent evt) {
		int[] clues = {5100};
		int[][] result = SkyScrapers.solvePuzzle(clues);

If you look at the private void jBShowActionPerformed method, I used the objects clues and result from the component file. The problem is, what kind of value I am supposed to put in the array of clues. You can see 5100 filled in here, but it already gave me some errors (ThrowNumberException) once I run this code and click the show button in the displayed UI.

There is another problem in private void jBShowActionPerformed, I wanted to display what I coded in my component file into the jScrollPanel component. That is why I placed skyscrapers.setText(skyscrapers); , which also threw me Exception error. I guess I should have used any other getSomething() method, but I have no idea what that Something is.

I appreciate any suggestion on the above problems. I do NOT wish anyone to rewrite the code for me, but I hit the wall and just need another set of insights.

If you’d like to see the full codes for better context of what I am fighting for, please take a look at SkyScrapers (component) and SkyScrapersTest (main).

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.