Note that there are some explanatory texts on larger screens.

plurals
  1. POJframe for generation of a Hiearchy of folders?
    primarykey
    data
    text
    <p>I am working on a JAVA project which involves building a hierarchy of folders. </p> <p>I'll simplify it. Suppose there is a organisation by the name ABC and it has 2 departments one is Java and the other one is Dotnet. They both in turn have 3 sub-departments(Core, JSP and EJB) for Java and (ASP, SilverLight and Ajax ) for Dotnet. </p> <p>The user provides the information about the structure of his Tree through a series of JFrames.In the First frame the user gives the name of the organisation and that is to be taken as the Head-Node. Parallelly a folder is created at ("C:\Users\Sam\OrganisationName")</p> <p>The JFrame has a "non-editable" JText field which displays the name of the parent of the currnt JFrame. </p> <p>Next JFrame asks if the user what are the number of Sub Groups the organisation has.So in this case the user gives 2 as i/p(Java and Dotnet). </p> <p>Next Jframe asks the user what is the name of the first subgroup and asks if it has further subgroups, if yes then how many . USer i/p = Java(folder created @ "C:\Users\Sam\OrganisationName\Java" ), Yes, 3(Core JSP and EJB). </p> <p>Now on clicking the Next button , the next 3 JFrames that pop-up should have the parent field as "Organisation/Java". Then the 4th frame should have the Parent field as "Organisation". Then again Jframes 5,6 &amp; 7 should have "Organisation/Dotnet".</p> <p>I am working towards a code that would be work for Tree of all sizes.Please help.</p> <p>Here's the Code if its useful for the JFrame that would take informatiion about the subgroups:</p> <pre><code>package SwingComponents; import java.awt.Color; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import javax.swing.*; import javax.swing.event.CaretEvent; import javax.swing.event.CaretListener; public class SubDirectoryFrameIII { static JFrames frame = new JFrames(); protected static int Number; int NumberOfGroups = JButtons.getNumberOfGroups(); public static JTextField GroupName = new JTextField(); public static JTextField NoOfSubGrups = new JTextField(); public static JTextField EmailId = new JTextField(); public static JTextField ParentName = new JTextField(); public static void GetGroupInformation(){ frame.setBounds(400, 10, 650, 700); frame.setResizable(false); JPanel panel = new JPanel(null); panel.setBackground(Color.gray); JLabel topLabel = new JLabel(); topLabel.setText("Group Information"); topLabel.setFont(new Font("Old English Text MT", 9, 30)); topLabel.setForeground(Color.WHITE); topLabel.setBounds(90, 30, 500, 40); JLabel Parent = new JLabel(); Parent.setText("Parent Group"); Parent.setFont(new Font("Algerian", 4, 20)); Parent.setBounds(30, 130, 150, 40); Parent.setForeground(Color.WHITE); ParentName.setText(new ValueFromFrames.FirstFrame().getOrganisationName()); ParentName.setEditable(false); ParentName.setBounds(300, 135, 230, 30); JLabel Group = new JLabel(); Group.setText("Group Name"); Group.setFont(new Font("Algerian", 4, 20)); Group.setBounds(30, 230, 150, 40); Group.setForeground(Color.WHITE); GroupName.setBounds(300, 235, 230, 30); JLabel EmailID = new JLabel(); EmailID.setText("Email ID"); EmailID.setFont(new Font("Algerian", 4, 20)); EmailID.setBounds(30, 330, 150, 40); EmailID.setForeground(Color.WHITE); EmailId.setBounds(300, 335, 230, 30); JLabel NoOfSubGroups = new JLabel(); NoOfSubGroups.setText("No Of SubGroups"); NoOfSubGroups.setFont(new Font("Algerian", 4, 20)); NoOfSubGroups.setBounds(30, 530, 400, 40); NoOfSubGroups.setForeground(Color.WHITE); NoOfSubGrups.setBounds(300, 535, 230, 30); NoOfSubGrups.addCaretListener(new CaretListener() { @Override public void caretUpdate(CaretEvent e) { try{ Number = Integer.parseInt(NoOfSubGrups.getText()); } catch(Exception exception){ JOptionPane.showMessageDialog(null, "Enter Valid Number"); } } }); JRadioButton Yes = new JRadioButton("YES"); Yes.setBounds(300, 435, 100, 30); Yes.setBackground(Color.GRAY); Yes.setFont(new Font("Algerian", 3, 15)); Yes.setSelected(true); Yes.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { NoOfSubGrups.setVisible(true); } }); JRadioButton No = new JRadioButton("NO"); No.setBounds(450, 435, 100, 30); No.setBackground(Color.GRAY); No.setFont(new Font("Algerian", 3, 15)); No.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { NoOfSubGrups.setVisible(false); } }); ButtonGroup Choices = new ButtonGroup(); Choices.add(Yes); Choices.add(No); JLabel isSubGroups = new JLabel(); isSubGroups.setText("Sub-Groups"); isSubGroups.setFont(new Font("Algerian", 40, 20)); isSubGroups.setBounds(30, 430, 400, 40); isSubGroups.setForeground(Color.WHITE); JButtons Next = new JButtons(); Next.setName("Next2"); Next.setText("Next"); Next.setForeground(Color.BLACK); Next.setBounds(500, 620, 100, 40); JButtons Back = new JButtons(); Back.setName("Back2"); Back.setText("Back"); Back.setForeground(Color.BLACK); Back.setBounds(30, 620, 100, 40); panel.add(GroupName); panel.add(Group); panel.add(ParentName); panel.add(Parent); panel.add(topLabel); panel.add(Yes); panel.add(No); panel.add(isSubGroups); panel.add(NoOfSubGrups); panel.add(NoOfSubGroups); panel.add(EmailID); panel.add(EmailId); panel.add(Next); panel.add(Back); frame.setVisible(true); frame.add(panel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload