Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2016
    Posts
    47
    Rep Power
    0

    Default When to use multiple tabs

    In an IDE each tab corresponds to a class right? If this is true, then why do some examples show more than one class declared inside of a single tab?

    Also, how do you know when to use multiple tabs? Why would a person use multiple tabs?

  2. #2
    benji2505 is offline Senior Member
    Join Date
    Sep 2014
    Location
    MA, USA
    Posts
    399
    Rep Power
    6

    Default Re: When to use multiple tabs

    I would step away from the idea that the tabs in the IDE are somehow relevant. Think in terms of Classes, Interfaces, etc.

    A tab does not correspond to a class, you can find Interfaces, xml files, fxml files and many other files in a separate tab.

    If you find two classes in one tab, it might be a class with an inner class. Depends on the syntax. You can not draw conclusions from the tabs layout in the IDE.

    The use of multiple tabs is the usual way in an IDE. The use of multiple classes (one for each entity in your project) is the fundamental idea behind OOP.

  3. #3
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,995
    Rep Power
    9

    Default Re: When to use multiple tabs

    Quote Originally Posted by allDogsAreGood View Post
    In an IDE each tab corresponds to a class right?
    Wrong.

    Quote Originally Posted by allDogsAreGood View Post
    If this is true, then why do some examples show more than one class declared inside of a single tab?
    As Benji said: inner classes.

    Quote Originally Posted by allDogsAreGood View Post
    Also, how do you know when to use multiple tabs? Why would a person use multiple tabs?
    Tabs have nothing to do with this. Tabs are only a view on a file. I can open the same file in IntelliJ using 12 tabs if I want, but I'm still editing the same file.

    A .java file can only contain one public class, but can also contain one or more private classes, interfaces, anonymous inner classes, etc. So since you can't edit multiple files in a single tab, you need multiple tabs when working on multiple files.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  4. #4
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    14

    Default Re: When to use multiple tabs

    Not certain what the issue is about tabs vs classes. In Eclipse, tabs are ways to delineate files.
    I can have many classes in one file in one tab (and the classes don't have to be inner classes).
    Associating classes with files, if that's what is happening is simply a characteristic, feature, whatever
    of the particular IDE you are using.

    And IDE's have nothing to do with the inherent nature of Java or any other programming language. IDE's
    are simply a tool to facilitate creating applications.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

Similar Threads

  1. Opening Multiple Tabs
    By foreverunited in forum New To Java
    Replies: 1
    Last Post: 09-27-2014, 01:48 PM
  2. Handling component in multiple Tabs
    By xlomo in forum New To Java
    Replies: 3
    Last Post: 02-19-2011, 02:32 PM
  3. SWT tabs with Draw2d
    By garyscarter in forum SWT / JFace
    Replies: 0
    Last Post: 07-07-2009, 03:31 PM
  4. Adding Tabs to JTabbedPane
    By blackstone in forum AWT / Swing
    Replies: 2
    Last Post: 11-14-2007, 03:15 PM
  5. resize tabs in jtabbedpane
    By osval in forum New To Java
    Replies: 1
    Last Post: 08-02-2007, 03:02 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •