Probleme d'affichage d'une tool Bar dans un panel
Bonjour,
J'ai un souci d'affichage d'un JToolBar dans un JPanle (voir pièce jointe : mauvaisAffichage.jpg).
je souhaite avoir le combo en haut et les autres juste au dessus (voir pièce jointe : bonAffichage.jpg).
Voici le bout de code que j'ai utilisé pour cette bar qui contient le JComboBox:
Code:
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
|
private JToolBar getTopToolBar() {
if (this.topToolBar == null) {
initCtHelp();
// Create the tool bar containing OIS Control functionnalities.
this.topToolBar = new JToolBar();
// Set the layout of the tool bar.
this.topToolBar.setLayout(new FlowLayout(FlowLayout.LEFT, 25, 0));
// Set the tool bar unfloatable.
this.topToolBar.setFloatable(false);
// Initialize the effectivity combo box.
this.effectivityComboBox = new EffectivityComboBox(
CTWrapperLPCNGConfigurationLoader.getInstance(),CLASSNAME
+ IConfigurationLoader.PROPERTY_SEPARATOR
+ "effectivityComboBox",getHelpBroker(), isHelpActive());
getCtWrapperLPCNG().addCtPropertyChangeListener(CTWrapperLPCNG.CURRENT_DU_KEY,
this.effectivityComboBox);
// getCtWrapperLPCNG().add
// ctWrapper
// .addEffectivityChangedFromBasketListener(this.effectivityComboBox);
//
// Model
// Initialize the combo box model.
final EffectivityComboBoxModel comboBoxModel = new EffectivityComboBoxModel(
getCtWrapperLPCNG());
// Attach the model to the combo box
this.effectivityComboBox.setModel(comboBoxModel);
// Action
final EffectivityAction eAction = new EffectivityAction();
this.effectivityComboBox.setAction(eAction);
this.effectivityComboBox.setActionCommand((String) eAction
.getValue(Action.ACTION_COMMAND_KEY));
// Add the effectivity combo box to the top tool bar.
this.topToolBar.add(this.effectivityComboBox);
// Register the effectivity combo box.
this.effectivityComboBox.register();
}
return this.topToolBar;
} |
et voici le code qui ajoute ce JToolBar au JPanel :
Code:
1 2 3 4 5
| JPanel jPanel = new JPanel();
LpcngToolBar lpcngToolBar = new LpcngToolBar(this);
lpcngToolBar.setVisible(true);
jPanel.add(lpcngToolBar,BorderLayout.NORTH); |
Avez-vous uen solution s'il vous plaît?.
J´ai rien compris là dessus
Salut
tes images montrent une chose, et ton code une autre chose, je te propose de donné le code responsable sur l´affichage de ta vue dûment complète.
et si t´as un souci avec la mise en place de tes composants, je te recommande d´utiliser FormLayout, ou bien MigLayout, qui sont des LayoutManager de très haute qualité, je les utilisent massivement dans mes projets.
cordialement