1
0

Połowa okna głównego

This commit is contained in:
2014-06-11 22:00:54 +02:00
parent 83b7b3855f
commit aa36c478d2
14 changed files with 181 additions and 1 deletions

View File

@@ -1,5 +1,7 @@
package ksiazka.kucharska;
import java.awt.EventQueue;
/**
* Hello world!
*
@@ -11,5 +13,15 @@ public class App
System.out.println( "Hello World!" );
System.out.println( "test repo!" );
System.out.println("\rPioDer test2\n");
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
FrmMain fMain = new FrmMain();
fMain.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}

View File

@@ -0,0 +1,99 @@
package ksiazka.kucharska;
import java.awt.BorderLayout;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JSplitPane;
import javax.swing.JButton;
import javax.swing.JTextField;
import java.awt.Dimension;
import javax.swing.SwingConstants;
import java.awt.GridLayout;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import javax.swing.JList;
public class FrmMain extends JFrame {
/**
*
*/
private static final long serialVersionUID = 2634383304749703669L;
private JPanel contentPane;
private JTextField txtWpiszTytutagi;
/**
* Create the frame.
*/
public FrmMain() {
setTitle("Książka Kucharska v1.0");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 800, 500);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
contentPane.setLayout(new BorderLayout(0, 0));
setContentPane(contentPane);
JSplitPane splitPane = new JSplitPane();
splitPane.setDividerSize(5);
splitPane.setEnabled(false);
splitPane.setResizeWeight(0.2);
contentPane.add(splitPane, BorderLayout.CENTER);
JPanel panel = new JPanel();
splitPane.setLeftComponent(panel);
GridBagLayout gbl_panel = new GridBagLayout();
gbl_panel.columnWidths = new int[] {0, 30};
gbl_panel.rowHeights = new int[] {0, 0, 0};
gbl_panel.columnWeights = new double[]{1.0, 0.0};
gbl_panel.rowWeights = new double[]{0.0, 1.0, 0.0};
panel.setLayout(gbl_panel);
txtWpiszTytutagi = new JTextField();
txtWpiszTytutagi.setText("wpisz tytuł/tagi...");
GridBagConstraints gbc_txtWpiszTytutagi = new GridBagConstraints();
gbc_txtWpiszTytutagi.insets = new Insets(0, 0, 5, 5);
gbc_txtWpiszTytutagi.fill = GridBagConstraints.HORIZONTAL;
gbc_txtWpiszTytutagi.gridx = 0;
gbc_txtWpiszTytutagi.gridy = 0;
panel.add(txtWpiszTytutagi, gbc_txtWpiszTytutagi);
txtWpiszTytutagi.setColumns(10);
JButton btnSearch = new JButton("Szukaj");
GridBagConstraints gbc_btnSearch = new GridBagConstraints();
gbc_btnSearch.insets = new Insets(0, 0, 5, 0);
gbc_btnSearch.gridx = 1;
gbc_btnSearch.gridy = 0;
panel.add(btnSearch, gbc_btnSearch);
JList recipesList = new JList();
GridBagConstraints gbc_recipesList = new GridBagConstraints();
gbc_recipesList.insets = new Insets(0, 0, 5, 0);
gbc_recipesList.gridwidth = 2;
gbc_recipesList.fill = GridBagConstraints.BOTH;
gbc_recipesList.gridx = 0;
gbc_recipesList.gridy = 1;
panel.add(recipesList, gbc_recipesList);
JPanel panel_1 = new JPanel();
GridBagConstraints gbc_panel_1 = new GridBagConstraints();
gbc_panel_1.gridwidth = 2;
gbc_panel_1.insets = new Insets(0, 0, 0, 5);
gbc_panel_1.fill = GridBagConstraints.BOTH;
gbc_panel_1.gridx = 0;
gbc_panel_1.gridy = 2;
panel.add(panel_1, gbc_panel_1);
panel_1.setLayout(new GridLayout(0, 2, 0, 0));
JButton btnAddRecipe = new JButton("Dodaj");
panel_1.add(btnAddRecipe);
JButton btnDelRecipe = new JButton("Usuń");
panel_1.add(btnDelRecipe);
}
}