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

  • Home
  • SEARCH
  • 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 6852607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:24:50+00:00 2026-05-27T01:24:50+00:00

I copied a tutorial program and made some modifications and now when i run

  • 0

I copied a tutorial program and made some modifications and now when i run it nothing happens.

I type java Teqscene into command prompt, it waits a few seconds and the shows the line for entering a new command. The program compiles fine and im new to swing so im not sure what iv missed ? can anyoun tell wht this program does not work ?

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;

public class Teqscene implements ActionListener, ChangeListener
{
    JFrame appFrame;
    JLabel[] captions = new JLabel[24];
    JLabel curScene;
    JSlider[] sliders = new JSlider[16];
    JButton scene1, scene2, scene3, scene4, save, load, connect, address, write;    
    GridBagConstraints[] gridBagConstraints = new GridBagConstraints[60];
    Container cPane;
    public static void main(String args[])
    {
        new Teqscene();
    }
    public void Teqscene() 
    {
        createGUI();
    }
    public void createGUI()
    {
        /*Create a frame, get its contentpane and set layout*/
        appFrame = new JFrame("Scene setter");
        cPane = appFrame.getContentPane();
        cPane.setLayout(new GridBagLayout());
        //Arrange components on contentPane and set Action Listeners to each JButton
        arrangeComponents();
        appFrame.pack();
        appFrame.setVisible(true);
    }
    public void arrangeComponents() 
    {
        for(int i = 0; i<24; i++)
        {
            captions[i] = new JLabel("100%");
        }
        for(int i = 0; i<24; i++)
        {
            sliders[i] = new JSlider(JSlider.VERTICAL, 0, 15, 15);
            sliders[i].addChangeListener(this);
            sliders[i].setMajorTickSpacing(1);
            sliders[i].setPaintTicks(true);
        }

        scene1 = new JButton("Scene 1");
        scene2 = new JButton("Scene 2");
        scene3 = new JButton("Scene 3");
        scene4 = new JButton("Scene 4");
        save = new JButton("Save Scene");
        load = new JButton("Load data");
        connect = new JButton("Connect to LCU");
        address = new JButton("Set LCU IP address");
        write = new JButton("Write to LCU");

        scene1.addActionListener(this);
        scene2.addActionListener(this);
        scene3.addActionListener(this);
        scene4.addActionListener(this);
        save.addActionListener(this);       
        load.addActionListener(this);
        connect.addActionListener(this);
        address.addActionListener(this);
        write.addActionListener(this);      

        /*add all initialized components to the container*/
        gridBagConstraints[0] = new GridBagConstraints();
        gridBagConstraints[0].gridx = 0;
        gridBagConstraints[0].gridy = 0;
        gridBagConstraints[0].insets = new Insets(5, 5, 5, 5);
        cPane.add(scene1, gridBagConstraints[0]);

        gridBagConstraints[1] = new GridBagConstraints();
        gridBagConstraints[1].gridx = 1;
        gridBagConstraints[1].gridy = 0;
        gridBagConstraints[1].insets = new Insets(5, 5, 5, 5);
        cPane.add(scene2, gridBagConstraints[1]);

        gridBagConstraints[2] = new GridBagConstraints();
        gridBagConstraints[2].gridx = 2;
        gridBagConstraints[2].gridy = 0;
        gridBagConstraints[2].insets = new Insets(5, 5, 5, 5);
        cPane.add(scene3, gridBagConstraints[2]);

        gridBagConstraints[3] = new GridBagConstraints();
        gridBagConstraints[3].gridx = 3;
        gridBagConstraints[3].gridy = 0;
        gridBagConstraints[3].insets = new Insets(5, 5, 5, 5);
        cPane.add(scene4, gridBagConstraints[3]);

        gridBagConstraints[4] = new GridBagConstraints();
        gridBagConstraints[4].gridx = 4;
        gridBagConstraints[4].gridy = 0;
        gridBagConstraints[4].insets = new Insets(5, 5, 5, 5);
        cPane.add(curScene, gridBagConstraints[4]);

        for(int i=5; i<17; i++)
        {
            gridBagConstraints[i] = new GridBagConstraints();
            gridBagConstraints[i].gridx = i-5;
            gridBagConstraints[i].gridy = 1;
            gridBagConstraints[i].insets = new Insets(5, 5, 5, 5);
            cPane.add(sliders[i-5], gridBagConstraints[i]);         
        }

        for(int i=17; i<29; i++)
        {
            gridBagConstraints[i] = new GridBagConstraints();
            gridBagConstraints[i].gridx = i-17;
            gridBagConstraints[i].gridy = 2;
            gridBagConstraints[i].insets = new Insets(5, 5, 5, 5);
            cPane.add(captions[i-17], gridBagConstraints[i]);           
        }

        for(int i=29; i<41; i++)
        {
            gridBagConstraints[i] = new GridBagConstraints();
            gridBagConstraints[i].gridx = i-29;
            gridBagConstraints[i].gridy = 3;
            gridBagConstraints[i].insets = new Insets(5, 5, 5, 5);
            cPane.add(sliders[i-29], gridBagConstraints[i]);            
        }

        for(int i=41; i<53; i++)
        {
            gridBagConstraints[i] = new GridBagConstraints();
            gridBagConstraints[i].gridx = i-41;
            gridBagConstraints[i].gridy = 4;
            gridBagConstraints[i].insets = new Insets(5, 5, 5, 5);
            cPane.add(captions[i-41], gridBagConstraints[i]);           
        }

        gridBagConstraints[53] = new GridBagConstraints();
        gridBagConstraints[53].gridx = 0;
        gridBagConstraints[53].gridy = 5;
        gridBagConstraints[53].insets = new Insets(5, 5, 5, 5);
        cPane.add(save, gridBagConstraints[53]);

        gridBagConstraints[54] = new GridBagConstraints();
        gridBagConstraints[54].gridx = 1;
        gridBagConstraints[54].gridy = 5;
        gridBagConstraints[54].insets = new Insets(5, 5, 5, 5);
        cPane.add(load, gridBagConstraints[54]);

        gridBagConstraints[55] = new GridBagConstraints();
        gridBagConstraints[55].gridx = 2;
        gridBagConstraints[55].gridy = 5;
        gridBagConstraints[55].insets = new Insets(5, 5, 5, 5);
        cPane.add(connect, gridBagConstraints[55]);

        gridBagConstraints[56] = new GridBagConstraints();
        gridBagConstraints[56].gridx = 3;
        gridBagConstraints[56].gridy = 5;
        gridBagConstraints[56].insets = new Insets(5, 5, 5, 5);
        cPane.add(address, gridBagConstraints[56]);

        gridBagConstraints[57] = new GridBagConstraints();
        gridBagConstraints[57].gridx = 4;
        gridBagConstraints[57].gridy = 5;
        gridBagConstraints[57].insets = new Insets(5, 5, 5, 5);
        cPane.add(write, gridBagConstraints[57]);       
    }
    public void actionPerformed(ActionEvent e)
    {
        if (e.getSource() == save) {
            save();
        } else if (e.getSource() == load) {
            load();
        } else if (e.getSource() == connect) {
            connect();
        } else if (e.getSource() == address) {
            address();
        } else if (e.getSource() == write) {
            write();
        }
    }
    public void stateChanged(ChangeEvent e)
    {
        for(int i = 0; i<24; i++)
        {
            if(e.getSource() == sliders[i])
            {
                //sliders[i].setValue(e.getValue);
            }
        }
    }
    void save()
    {

    }
    void load()
    {

    }
    void connect()
    {

    }
    void address()
    {

    }
    void write()
    {

    }
}
  • 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-27T01:24:50+00:00Added an answer on May 27, 2026 at 1:24 am
    public void Teqscene() 
    {
        createGUI();
    }
    

    Change this to

    public Teqscene() 
    {
        createGUI();
    }
    

    Here the problem is inside the main method only an object is created. When creating the object constructor is called. In your program only the default constructor exits.

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

Sidebar

Related Questions

I'm trying to compile the basic tutorial program at http://doc.trolltech.com/4.4/mainwindows-application.html and running into a
I have just copied Key-Listener code from http://java.sun.com/docs/books/tutorial/uiswing/examples/events/KeyEventDemoProject/src/events/KeyEventDemo.java . I was able to compalie
I am following the django tutorial here . I have copied everything exactly. After
I copied some Delphi code from one project to another, and found that it
I copied the following script and run it to have it listen on port
Following the Crucial staging setup tutorial , I copied our live setup to a
Does anyone have a good tutorial on Java + Cucumber integration? I've begun using
I am working my way through some of the android developers tutorial, specifically the
I'm using a tutorial to write a fairly simple app. I copied the app
I've tried according to this tutorial but failed. I've got everything copied exactly as

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.