(PanelManager pmgr, Icon wizardIcon)
| 201 | } |
| 202 | |
| 203 | private void init(PanelManager pmgr, Icon wizardIcon) { |
| 204 | this.panelMgr = pmgr; |
| 205 | this.panelMgr.setWizardManager(this); |
| 206 | |
| 207 | Dimension panelSize = panelMgr.getPanelSize(); |
| 208 | currJPanel = new JPanel(); |
| 209 | currJPanel.setPreferredSize(panelSize); |
| 210 | currJPanel.setMinimumSize(panelSize); |
| 211 | |
| 212 | scrollPane = new JScrollPane(); |
| 213 | scrollPane.setBorder(BorderFactory.createEmptyBorder()); |
| 214 | scrollPane.setPreferredSize(panelSize); |
| 215 | scrollPane.setMinimumSize(panelSize); |
| 216 | |
| 217 | scrollPane.addComponentListener(new ComponentAdapter() { |
| 218 | @Override |
| 219 | public void componentResized(ComponentEvent e) { |
| 220 | updateScrollPaneBorder(currJPanel); |
| 221 | } |
| 222 | }); |
| 223 | |
| 224 | // Load custom icon from resources if wizardIcon is null |
| 225 | if (wizardIcon == null) { |
| 226 | try { |
| 227 | wizardIcon = ResourceManager.loadImage("images/icon_50.png"); |
| 228 | } catch (Exception e) { |
| 229 | // If loading fails, fall back to no icon |
| 230 | wizardIcon = null; |
| 231 | } |
| 232 | } |
| 233 | |
| 234 | // Create title label without icon - icon will be handled separately |
| 235 | titleLabel = new GDLabel(INIT_TITLE); |
| 236 | // Make the title text bold |
| 237 | Font currentFont = titleLabel.getFont(); |
| 238 | titleLabel.setFont(currentFont.deriveFont(Font.BOLD)); |
| 239 | |
| 240 | JPanel titlePanel = new JPanel(new BorderLayout()); |
| 241 | titlePanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(), |
| 242 | BorderFactory.createEmptyBorder(5, 5, 5, 5))); |
| 243 | |
| 244 | // Add icon to the left if available |
| 245 | if (wizardIcon != null) { |
| 246 | JLabel iconLabel = new JLabel(wizardIcon); |
| 247 | titlePanel.add(iconLabel, BorderLayout.WEST); |
| 248 | } |
| 249 | |
| 250 | // Create a centered panel for the title text |
| 251 | JPanel centerPanel = new JPanel(); |
| 252 | centerPanel.setLayout(new BoxLayout(centerPanel, BoxLayout.X_AXIS)); |
| 253 | centerPanel.add(Box.createHorizontalGlue()); |
| 254 | centerPanel.add(titleLabel); |
| 255 | centerPanel.add(Box.createHorizontalGlue()); |
| 256 | |
| 257 | titlePanel.add(centerPanel, BorderLayout.CENTER); |
| 258 | |
| 259 | mainJPanel = new JPanel(new BorderLayout()); |
| 260 | mainJPanel.add(titlePanel, BorderLayout.NORTH); |
no test coverage detected