Java
amani26
-
tsunamidream Messages postés 283 Statut Membre -
tsunamidream Messages postés 283 Statut Membre -
Bonjour, je suis entrain de programmer une interface en java qui a pour rôle d'afficher une liste de site web. Devant chaque site web affiché il y 'a 3 icônes: "modifier, supprimer, afficher détail". J'ai fais des recherches mais sans résultat. Est ce que vous pouvez me donner une portion de code ou quelques liens pour m'aider ? Merci.
A voir également:
- Java
- Jeux java itel - Télécharger - Jeux vidéo
- Waptrick java football - Télécharger - Jeux vidéo
- Waptrick java voiture - Télécharger - Jeux vidéo
- Java apk - Télécharger - Langages
- Eclipse java - Télécharger - Langages
3 réponses
J'ai essayé de faire quelque chose j'espère que ca va vous aider :
import javax.swing.*;
public class liensgui extends JFrame{
//Variables
private JPanel container;
private JTextField lien1;
private JButton modifier1;
private JButton suppr1;
private JButton detail1;
//Getters
public JPanel getContainer(){
if (container == null){
container = new JPanel(null);
}
return container;
}
public JTextField getLien1(){
if (lien1 == null){
lien1 = new JTextField(22);
}
return lien1;
}
public JButton getModifier1(){
if (modifier1 == null){
modifier1 = new JButton("Modifier");
}
return modifier1;
}
public JButton getSuppr1(){
if (suppr1 == null){
suppr1 = new JButton("Supprimer");
}
return suppr1;
}
public JButton getDetail1(){
if (detail1 == null){
detail1 = new JButton("Details");
}
return detail1;
}
//Constructeur
public liensgui(){
this.setTitle("Liens Webs");
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
getContainer().add(getLien1());
getContainer().add(getModifier1());
getContainer().add(getSuppr1());
getContainer().add(getDetail1());
this.init();
setContentPane(getContainer());
this.setResizable(false);
this.setVisible(true);
}
//Inititalisation de la partie graphique
public void init(){
setLayout(null);
int x = 10;
int y = 10;
getLien1().setBounds(x, y, getLien1().getPreferredSize().width, getLien1().getPreferredScrollableViewportSize().height);
y = y + getLien1().getPreferredSize().height;
getModifier1().setBounds(x, y, getModifier1().getPreferredSize().width, getModifier1().getPreferredSize().height);
x = x + getModifier1().getPreferredSize().width;
getSuppr1().setBounds(x, y, getSuppr1().getPreferredSize().width, getSuppr1().getPreferredSize().height);
x = x + getSuppr1().getPreferredSize().width;
getDetail1().setBounds(x, y, getDetail1().getPreferredSize().width, getDetail1().getPreferredSize().height);
y = y + getModifier1().getPreferredSize().height + 30;
x = x + getSuppr1().getPreferredSize().width ;
setSize(x, y);
}
}
Je n'es pas fait le traitement des boutons. Si vous avez des problèmes pour ca n'hésitez pas.
import javax.swing.*;
public class liensgui extends JFrame{
//Variables
private JPanel container;
private JTextField lien1;
private JButton modifier1;
private JButton suppr1;
private JButton detail1;
//Getters
public JPanel getContainer(){
if (container == null){
container = new JPanel(null);
}
return container;
}
public JTextField getLien1(){
if (lien1 == null){
lien1 = new JTextField(22);
}
return lien1;
}
public JButton getModifier1(){
if (modifier1 == null){
modifier1 = new JButton("Modifier");
}
return modifier1;
}
public JButton getSuppr1(){
if (suppr1 == null){
suppr1 = new JButton("Supprimer");
}
return suppr1;
}
public JButton getDetail1(){
if (detail1 == null){
detail1 = new JButton("Details");
}
return detail1;
}
//Constructeur
public liensgui(){
this.setTitle("Liens Webs");
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
getContainer().add(getLien1());
getContainer().add(getModifier1());
getContainer().add(getSuppr1());
getContainer().add(getDetail1());
this.init();
setContentPane(getContainer());
this.setResizable(false);
this.setVisible(true);
}
//Inititalisation de la partie graphique
public void init(){
setLayout(null);
int x = 10;
int y = 10;
getLien1().setBounds(x, y, getLien1().getPreferredSize().width, getLien1().getPreferredScrollableViewportSize().height);
y = y + getLien1().getPreferredSize().height;
getModifier1().setBounds(x, y, getModifier1().getPreferredSize().width, getModifier1().getPreferredSize().height);
x = x + getModifier1().getPreferredSize().width;
getSuppr1().setBounds(x, y, getSuppr1().getPreferredSize().width, getSuppr1().getPreferredSize().height);
x = x + getSuppr1().getPreferredSize().width;
getDetail1().setBounds(x, y, getDetail1().getPreferredSize().width, getDetail1().getPreferredSize().height);
y = y + getModifier1().getPreferredSize().height + 30;
x = x + getSuppr1().getPreferredSize().width ;
setSize(x, y);
}
}
Je n'es pas fait le traitement des boutons. Si vous avez des problèmes pour ca n'hésitez pas.