1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
public class StepPanel extends JScrollPane
{
/***************************************************************************
* Label de présentation de l'étape
*/
private JLabel header;
/**
* Contenu de l'étape
*/
private JEditorPane body;
/**
* @param stepToPresent
* @param rang
* @param total
*/
public StepPanel(Step stepToPresent, int rang, int total)
{
super( JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
// panneaux global nécessaire pour des contrainte de présentation
// panneaux interne
JPanel innerPane = new JPanel();
innerPane.setLayout(new BorderLayout());
innerPane.setBackground(Color.WHITE);
innerPane.setOpaque(true);
int innerPaneBorderSize = 7;
innerPane.add(Box.createHorizontalStrut(innerPaneBorderSize),
BorderLayout.EAST);
innerPane.add(Box.createHorizontalStrut(innerPaneBorderSize),
BorderLayout.WEST);
innerPane.setPreferredSize(new Dimension(this.getWidth(), 1500));
/*
this.setViewportView(innerPane);
this.viewport.setPreferredSize(this.getSize());
*/
// entete du descriptif de l'étape
String title = "<html>";
if (stepToPresent.getName() != null)
{
String name = stepToPresent.getName();
title += " " + name ;
}
title+= " (" + rang+ "/" + total + ") : </html>";
this.header = new JLabel(title);
innerPane.add(this.header, BorderLayout.NORTH);
// corps du descriptif de l'étape
this.body = new JEditorPane();
this.body.setEditable(false);
this.body.setOpaque(true);
this.body.setContentType("text/html");
String message;
if (stepToPresent.getComment() == null)
{
message = LanguagesManager.getInstance().getString("noComment");
}
else
{
message = stepToPresent.getComment();
}
this.body.setBackground(Color.WHITE);
this.body.setText(message);
innerPane.add(this.body);
this.setViewportView(innerPane);
this.viewport.setPreferredSize(this.getSize());
//JScrollPane jsBodyStep = new JScrollPane(innerPane, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
//innerPane.add(jsBodyStep, BorderLayout.CENTER);
//this.viewport.setLocation(this.header.getLocation());
}
} |
Partager