Re: Generate roof plugin

by byDMA » Sun Jun 16, 2024 4:55 pm

I have to study this part (but not today) (GenrateRoofPluginView.java)
The Insets must be set correct according to
https://docs.oracle.com/javase/8/docs/a ... nsets.html
and
https://docs.oracle.com/javase/8/docs/a ... aints.html

Code: Select all

/**
	 * Layout user interface
	 * @author Daniels118
	 */
	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, 1, 1, 1, 0, 0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(0, 10, 0, 0), 0, 0));
		}
		// Column 4 Row 2~4
		roofPanel.add(scrollEdgesPane,
				new GridBagConstraints(4, 2, 1, 4, 0, 0, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
		// Column 5 Row 0
		roofPanel.add(resetButton,
				new GridBagConstraints(5, 0, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 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 5 Row 1
		roofPanel.add(invisibilityPane,
				new GridBagConstraints(5, 2, 1, 1, 0, 0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
		// Column 5 Row 3+4
		roofPanel.add(faceAngleSlider,
				new GridBagConstraints(5, 3, 1, 2, 0, 1, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
		// Column 5 Row 5
		roofPanel.add(finePane,
				new GridBagConstraints(5, 5, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
		// Column 4 Row 6
		roofPanel.add(thickPane,
				new GridBagConstraints(4, 6, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
		// Column 5 Row 6
		roofPanel.add(elevationPane,
				new GridBagConstraints(5, 6, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
		// Column 4 Row 9
		roofPanel.add(creatorPane,
				new GridBagConstraints(4, 9, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 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(0, 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(0, 0, 0, 0), 0, 0));
		// Column 3 Row 9
		roofPanel.add(reverseFaces,
				new GridBagConstraints(3, 9, 1, 1, 0, 0, GridBagConstraints.LINE_END, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));		
		// Column 4 Row 8
		roofPanel.add(bordersPane,
				new GridBagConstraints(4, 8, 2, 1, 0, 0, GridBagConstraints.SOUTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));	
		// Column 5 Row 9
		roofPanel.add(aboutButton,
				new GridBagConstraints(5, 9, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
		
		// First refresh roof
		edgesList.updateUI();
		plugin.refreshRoof(plugin.homeView, plugin.resource);
		return roofPanel;
	}
or I ask someone in my company.