Re: Generate roof plugin

by byDMA » Sat Jun 22, 2024 10:43 am

So, here we are. I compiled it myself and experimented with the sizes. Now it does not matter which language is used and how long or short the words are in the TittledBorder. There is no need to do tricks with the words when translating. I also tried to distribute the components and the distances evenly.
Image
Image
Image
Image

Only this is needed:
1. fix width of the edgeList

Code: Select all

edgesList.setFixedCellWidth(200);// byDMA resize width of the List in the JScrollPane
2. corrected grids
explained: ipadx changes the width of JScrollPanel with the EdgeList.
scrollEdgesPane -> 200
faceAngleSlider -> 125

Code: Select all

*/
	//TODO byDMA
	/**
    * Layout user interface
    * @author Daniels118 & byDMA
    */
   protected JPanel createUI() {
           JPanel roofPanel = SwingTools.createTitledPanel(null);
           roofPanel.setBorder(null);
           // Column 0~3 Row 0~9
           roofPanel.add(roofPreview,
                           new GridBagConstraints(0, 0, 4, 9, 1, 1, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
           // Column 4 Row 1
           if (OperatingSystem.isMacOSX()) {
                   roofPanel.add(edgesLabel,
                                   new GridBagConstraints(4, 0, 2, 1, 0, 0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(0, 10, 0, 0), 0, 0));
           }
           // Column 4+5 Row 0~7
           roofPanel.add(scrollEdgesPane,
                           new GridBagConstraints(4, 0, 2, 7, 0, 0, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 200, 0));
           // Column 4+5 Row 9
           roofPanel.add(resetButton,
                           new GridBagConstraints(4, 9, 2, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(15, 0, 0, 5), 0, 0));
           if (OperatingSystem.isMacOSX()) {
                   roofPanel.add(invisibilityLabel,
                                   new GridBagConstraints(5, 1, 1, 1, 0, 0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(0, 10, 0, 0), 0, 0));
           }
           // Column 6+7 Row 0
           roofPanel.add(invisibilityPane,
                           new GridBagConstraints(6, 0, 2, 1, 0, 0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 15));
           // Column 6+7 Row 1~5
           roofPanel.add(faceAngleSlider,
                           new GridBagConstraints(6, 1, 2, 5, 0, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(10, 0, 0, 0), 125, 0));
           // Column 6+7 Row 6
           roofPanel.add(finePane,
                           new GridBagConstraints(6, 6, 2, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(10, 0, 0, 0), 0, 15));
           // Column 4+5 Row 7
           roofPanel.add(thickPane,
                           new GridBagConstraints(4, 7, 2, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(10, 0, 0, 0), 0, 15));
           // Column 6+7 Row 7
           roofPanel.add(elevationPane,
                           new GridBagConstraints(6, 7, 2, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(10, 0, 0, 0), 0, 15));
           // Column 6+7 Row 8
           roofPanel.add(creatorPane,
                           new GridBagConstraints(6, 8, 2, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(10, 0, 0, 0), 0, 0));
           // Column 0 Row 9
           roofPanel.add(showHome,
                           new GridBagConstraints(0, 9, 1, 1, 1, 0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(15, 0, 0, 0), 0, 0));
           // Column 2 Row 9
           roofPanel.add(showTexture,
                           new GridBagConstraints(2, 9, 1, 1, 0, 0, GridBagConstraints.LINE_END, GridBagConstraints.HORIZONTAL, new Insets(15, 0, 0, 15), 0, 0));
           // Column 3 Row 9
           roofPanel.add(reverseFaces,
                           new GridBagConstraints(3, 9, 1, 1, 0, 0, GridBagConstraints.LINE_END, GridBagConstraints.HORIZONTAL, new Insets(15, 0, 0, 15), 0, 0));
           // Column 4+5 Row 8
           roofPanel.add(bordersPane,
                           new GridBagConstraints(4, 8, 2, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(10, 0, 0, 0), 0, 0));
           // Column 6+7 Row 9
           roofPanel.add(aboutButton,
                           new GridBagConstraints(6, 9, 2, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(15, 5, 0, 0), 0, 0));

           // First refresh roof
           edgesList.updateUI();
           plugin.refreshRoof(plugin.homeView, plugin.resource);
           return roofPanel;
   }