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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:51:41+00:00 2026-05-25T02:51:41+00:00

I`m very new to Java and I want to create a program and I

  • 0

I`m very new to Java and I want to create a program and I already have some problems styling it. I want a simple program with the following structure:

The first line should be the menubar with file and about buttons.
In the second line I should have a text: “url: “, a text input (for the url) and a “go” button after the text input.
On the third line I need a tabbed menu with 3 tabs: tab1, tab2, tab3.

The rest of the content until the bottom of the window should be a table with rows and columns and it should have vertical and horizontal scroll bars if the content is too big and if the window is bigger than the table than it should fill the entire window.

For now I have only this code:

main.java :

import javax.swing.*;

public class main {

    public static void main(String args[]){

        JFrame frame = new JFrame("SEO Tool");      
        frame.setSize(500,300);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setExtendedState(frame.getExtendedState() | JFrame.MAXIMIZED_BOTH);
        frame.setVisible(true);

        menubar menubar = new menubar(); 
        menubar.createmenubar_site(frame);

        tabs tabs = new tabs();
        tabs.createtabs(frame); 
    }
}

tabs.java :

import javax.swing.*;
import javax.swing.BoxLayout;

public class tabs {

    public void createtabs(JFrame frame){

        JLabel sitelabel = new JLabel("A");

        JPanel sitepanel = new JPanel();
        sitepanel.setLayout(new BoxLayout(sitepanel, BoxLayout.X_AXIS));
        sitepanel.setSize(400,400);
        sitepanel.add(sitelabel);
        frame.add(sitepanel);

        JPanel panel = new JPanel();
        panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
        //panel.setBounds();
        frame.add(panel);

        JTabbedPane tabs = new JTabbedPane();

        JPanel yoursite = new JPanel();
        JPanel yourcompetitors = new JPanel();

        tabs.addTab("Your site",yoursite);
        tabs.addTab("Your competitors",yourcompetitors);

        panel.add(tabs);        

        sitetab sitetab = new sitetab();
        sitetab.createcontent(yoursite);    
    }
}

menubar.java :

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

public class menubar {

    public void createmenubar_site(JFrame frame){

        JMenuBar menubar = new JMenuBar();
        frame.setJMenuBar(menubar);

        JMenu file = new JMenu("File");
        menubar.add(file);

        JMenuItem newproject = new JMenuItem("New Project");
        newproject .addActionListener(new click_newproject());
        file.add(newproject);
    }

    static class click_newproject implements ActionListener {

        public void actionPerformed (ActionEvent e){            
        }
    }
}
  • 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-25T02:51:41+00:00Added an answer on May 25, 2026 at 2:51 am

    That’s the example of layout you described as i understood (i made it using NetBeans WYSIWYG – good tool, but you should understand layouts anyway). It doesn’t use your code but can give you basic understanding of how it can be done. I would recommend you read more about layouts here http://download.oracle.com/javase/tutorial/uiswing/layout/using.html .

    private void initComponents() {
    
        urlPanel = new javax.swing.JPanel();
        urlLabel = new javax.swing.JLabel();
        urlField = new javax.swing.JTextField();
        urlButton = new javax.swing.JButton();
        tabbedPane = new javax.swing.JTabbedPane();
        tab1 = new javax.swing.JPanel();
        tab2 = new javax.swing.JPanel();
        tab3 = new javax.swing.JPanel();
        tableScrollPane = new javax.swing.JScrollPane();
        table = new javax.swing.JTable();
        mainMenu = new javax.swing.JMenuBar();
        fileMenu = new javax.swing.JMenu();
        aboutMenu = new javax.swing.JMenu();
    
        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        getContentPane().setLayout(new javax.swing.BoxLayout(getContentPane(), javax.swing.BoxLayout.Y_AXIS));
    
        urlPanel.setLayout(new java.awt.BorderLayout());
    
        urlLabel.setText("url:");
        urlPanel.add(urlLabel, java.awt.BorderLayout.WEST);
    
        urlField.setText("http://google.com");
        urlPanel.add(urlField, java.awt.BorderLayout.CENTER);
    
        urlButton.setText("Go");
        urlPanel.add(urlButton, java.awt.BorderLayout.EAST);
    
        getContentPane().add(urlPanel);
    
        javax.swing.GroupLayout tab1Layout = new javax.swing.GroupLayout(tab1);
        tab1.setLayout(tab1Layout);
        tab1Layout.setHorizontalGroup(
            tab1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 395, Short.MAX_VALUE)
        );
        tab1Layout.setVerticalGroup(
            tab1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 32, Short.MAX_VALUE)
        );
    
        tabbedPane.addTab("tab1", tab1);
    
        javax.swing.GroupLayout tab2Layout = new javax.swing.GroupLayout(tab2);
        tab2.setLayout(tab2Layout);
        tab2Layout.setHorizontalGroup(
            tab2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 395, Short.MAX_VALUE)
        );
        tab2Layout.setVerticalGroup(
            tab2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 32, Short.MAX_VALUE)
        );
    
        tabbedPane.addTab("tab2", tab2);
    
        javax.swing.GroupLayout tab3Layout = new javax.swing.GroupLayout(tab3);
        tab3.setLayout(tab3Layout);
        tab3Layout.setHorizontalGroup(
            tab3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 395, Short.MAX_VALUE)
        );
        tab3Layout.setVerticalGroup(
            tab3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 32, Short.MAX_VALUE)
        );
    
        tabbedPane.addTab("tab3", tab3);
    
        getContentPane().add(tabbedPane);
    
        tableScrollPane.setViewportView(table);
    
        getContentPane().add(tableScrollPane);
    
        fileMenu.setText("File");
        mainMenu.add(fileMenu);
    
        aboutMenu.setText("About");
        mainMenu.add(aboutMenu);
    
        setJMenuBar(mainMenu);
    
        pack();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am very new to Java, I want to add a PNG image to
I'm soon going to check in the very first commit of a new Java
I am very new to PHP I want to create a byte array something
Suppose I am building a very simple eclipse plugin for creating new java projects.
My question is very similar to Java: HTTP Post to create new "Product" in
I want to create such object in Java that will contain some dispatcher function
To preface, I'm very new to Obj-C but I do have some OOP experience
i want to create a very simple JMS standalone client to a JMS Topic
I have the following simple script, which I am using to dynamically create the
Hi I'm very new to android development, and want to create an app with

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.