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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:42:41+00:00 2026-06-04T04:42:41+00:00

How do I connect a frame to an existing frame? The code below is

  • 0

How do I connect a frame to an existing frame?

The code below is the code for the appletframe. What I want to do is add the other code which is for the frame to be connected to the bottom of the AppletFrame, so that when I drag the Appletframe the frame code with we dragged with it as well. Basically I want the frame code to be attached with the appletFrame so that both the frames are together.

AppletFrame

    appletFrame = new JFrame(Settings.serverName);
            Loader.webclient = false;
            appletFrame.setLayout(new BorderLayout());
            appletFrame.setDefaultCloseOperation(3);
            appletPanel.setLayout(new BorderLayout());
            appletFrame.setIconImage(Toolkit.getDefaultToolkit().getImage(this.getClass().getResource("/resources/icon.png")));
            appletPanel.add(this);
            appletPanel.setPreferredSize(new Dimension(767, 537));
            appletFrame.getContentPane().add(appletPanel, "Center");
            appletFrame.pack();
            appletFrame.setLocationRelativeTo(null);
            appletFrame.setVisible(true);
    JMenuBar jmenubar = new JMenuBar();
            appletFrame.setJMenuBar(jmenubar);
            Layout = new FlowLayout();
            ImageIcon keyboard = new ImageIcon(Toolkit.getDefaultToolkit().getImage(this.getClass().getResource("/resources/keyboard.png")));
            ImageIcon wrench = new ImageIcon(Toolkit.getDefaultToolkit().getImage(this.getClass().getResource("/resources/wrench.png")));
            Button1 = new JButton("Vote");
            Button2 = new JButton("Item List");
            Button3 = new JButton("Screenshot");
            Button4 = new JButton(wrench);
            Button5 = new JButton(keyboard);
            Button4.setBorder(null);
            Button4.setBorderPainted(false);
            Button4.setContentAreaFilled(false);
            Button5.setBorder(null);
            Button5.setBorderPainted(false);
            Button5.setContentAreaFilled(false);
            jmenubar.setLayout(Layout);
            jmenubar.add(Button1);
            jmenubar.add(Button2);
            jmenubar.add(Button3);
            jmenubar.add(Button4);
            jmenubar.add(Button5);
            Button1.addActionListener(this);
            Button2.addActionListener(this);
            Button3.addActionListener(this);
            Button4.addActionListener(this);
            Button5.addActionListener(this);
            Button1.setText("Vote");
            Button2.setText("Item List");
            Button3.setText("Screenshot");

Frame which I want it to be attached with the AppletFrame. I want this to be attached to the bottom of the appletFrame, but I don’t know how to do it.

JFrame frame = new JFrame(); 
        frame.setSize(775,121); 
        frame.setResizable(false); 
        JTextArea textArea = new JTextArea("TEST"); 
        textArea.setSize(400,400);          
        textArea.setLineWrap(true);     
        textArea.setEditable(false);    
        textArea.setVisible(true);     
        JScrollPane scroll = new JScrollPane (textArea);    
        scroll.setVerticalScrollBarPolicy   (JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);          
        scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);     
        frame.add(scroll);    
        frame.setVisible(true);     
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  • 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-04T04:42:42+00:00Added an answer on June 4, 2026 at 4:42 am

    As I alluded to in my first comment, this GUI would be better combined into a single top-level container.

    Here is an SSCCE1 (mentioned in my 2nd comment) that shows the basic idea, though now I have a better idea of the effect required, the JSplitPane seems less appropriate. Here I just combine the GUI elements into the same layout.

    TestGUI

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    
    class TestGUI extends JPanel {
    
        TestGUI() {
            JFrame appletFrame = new JFrame("Settings.serverName");
            appletFrame.setLayout(new BorderLayout());
            appletFrame.setDefaultCloseOperation(3);
    
            JPanel appletPanel = new JPanel(new BorderLayout());
    
            appletPanel.add(this);
            appletPanel.setPreferredSize(new Dimension(767, 537));
            appletFrame.getContentPane().add(appletPanel, BorderLayout.CENTER);
    
            // Don't use a menu-bar as a tool-bar!
            JToolBar jmenubar = new JToolBar();
            appletPanel.add(jmenubar, BorderLayout.PAGE_START);
            JButton Button1 = new JButton("Vote");
            JButton Button2 = new JButton("Item List");
            JButton Button3 = new JButton("Screenshot");
            JButton Button4 = new JButton("wrench");
            JButton Button5 = new JButton("keyboard");
            Button4.setBorder(null);
            Button4.setBorderPainted(false);
            Button4.setContentAreaFilled(false);
            Button5.setBorder(null);
            Button5.setBorderPainted(false);
            Button5.setContentAreaFilled(false);
            jmenubar.setLayout(new FlowLayout());
            jmenubar.add(Button1);
            jmenubar.add(Button2);
            jmenubar.add(Button3);
            jmenubar.add(Button4);
            jmenubar.add(Button5);
    
            JTextArea textArea = new JTextArea("TEST", 4, 65 );
            textArea.setLineWrap(true);
            textArea.setEditable(false);
            textArea.setVisible(true);
            JScrollPane scroll = new JScrollPane (
                textArea,
                JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
            appletPanel.add(scroll, BorderLayout.PAGE_END);
    
            appletFrame.pack();
            appletFrame.setLocationByPlatform(true);
            appletFrame.setVisible(true);
        }
    
        public static void main(String[] args) {
            SwingUtilities.invokeLater( new Runnable() {
                public void run() {
                    new TestGUI();
                }
            });
        }
    }
    
    1. And yes, this would have arrived sooner if I’d had an SSCCE to start with. 😉
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the iOS UIViewController code below, I connect to a server that uses a
Facebook Connect and their Social Widgets documentation mention that you need to add an
i want to write a simple web app that can connect to databases and
To connect my server with the APN server I use the following code. //
This is my Facebook connect Code: <script> jQuery(document).ready(function($){ $(.fb-login-button).live('click', function() { console.log('click'); fbEnsureInit(function() {
I have written a set of Win32 dlls that encapsulate a Delphi Frame (see
I'm using frames. My logo frame contains 2 pictures. One is 150px and other
I have a code in which all UI items created by dynamically. I have
I want to use a signals/slots library in a project that doesn't use QT.
I do this in my code, capturing a frame from camera, opening a UDP

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.