From 080f7a2cb9d11a0c0faec76be9c7409244e571da Mon Sep 17 00:00:00 2001 From: Adah Boukhari Date: Tue, 4 Feb 2020 00:35:47 +0100 Subject: [PATCH 1/3] Commit_28 Funktionalitaet Table_Inhalt loeschen implementiert --- .../bin/MeinBudgetView/MeinGui$1.class | Bin 738 -> 738 bytes .../bin/MeinBudgetView/MeinGui$2.class | Bin 1122 -> 1110 bytes .../bin/MeinBudgetView/MeinGui.class | Bin 6817 -> 6922 bytes .../src/MeinBudgetView/MeinGui.java | 50 ++++++++---------- 4 files changed, 22 insertions(+), 28 deletions(-) diff --git a/Budget Projekt/bin/MeinBudgetView/MeinGui$1.class b/Budget Projekt/bin/MeinBudgetView/MeinGui$1.class index b7dca50bccb76423317aa438f197c9c1a5d5fd22..46a9523230d4bc896f7d4ec0362845373b3be2ad 100644 GIT binary patch delta 35 qcmaFF`iOOd3KOH{WL2h6K^q1R23rPR20I2p273lk2FJ!f=K` q4k)g`zzovBAP;1LfGUF`gAz~=$dEbAMvNCGpJ(=9yf#^a#R~vJdk~HQ delta 114 zcmcb{@rYxC8Z&1#11kdy0|SHRWPN5upGX##kgW{T8-W5$46;B{ih&JCo@L->xWXXB za1|(ai$R&;HiHIGOb#fcz`zV7H5ufAED+FSP-IX7>IE4%f!T=h#^l4y9*p-U^RRdU E096+gS^xk5 diff --git a/Budget Projekt/bin/MeinBudgetView/MeinGui.class b/Budget Projekt/bin/MeinBudgetView/MeinGui.class index 66011f56a7e6b90edcff39d2c3868fb202ea81af..7902d792f14eed3889d7eb4f29f393cf41d63179 100644 GIT binary patch delta 1440 zcmaiyeN2^Q7{-71`#vvl4(GrDK}1VA(@cr^vC>(D)2J;`FvUdh6FW!5p{N{0MLm$2 zQ*)MYmgTfeS2E4%!44KuR<`_HZEZPH(J`7u`B7&5;YU3OoaOq%_mBI&-h0<`z1RJ` z*Y+W6hdPhn{^V0&sLbB)T<#7!X_wJ186&wuOo=~`Tki9h32FWMkC{`vsCe+{SjZj`z%i>@bh9)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jhv;69#X5yZ6^5X?21DHK*tC62<7NM`*)OoH3tJV^KU(ZXI@97Q=^%JouS zX7Yy<{zhM1iiC}#CYs;I7g0dV8DpS%G$YXb+!D(FF~lDsU(j@p>$+`Vs|}Nx^0&T~ s$$`lFj@a0hz91R54G_nf#ZUPEo0*_OUk$W^idaT+6-g|8V>BTC0of`vM*si- diff --git a/Budget Projekt/src/MeinBudgetView/MeinGui.java b/Budget Projekt/src/MeinBudgetView/MeinGui.java index 7be8d26..75db528 100644 --- a/Budget Projekt/src/MeinBudgetView/MeinGui.java +++ b/Budget Projekt/src/MeinBudgetView/MeinGui.java @@ -44,12 +44,11 @@ public class MeinGui extends JFrame implements ActionListener { public static int budget; public static int expenses; public static int balance; - private JTextField textExpensesName; - private JLabel ausgabenName; - private JLabel ausgabenBetrag; - private JLabel budgetBetrag; - private JTable myTable; - + public static JTextField textExpensesName; + public static JLabel ausgabenName; + private static JLabel ausgabenBetrag; + private static JLabel budgetBetrag; + private static JTable myTable; /** * Launch the application. @@ -178,46 +177,39 @@ public class MeinGui extends JFrame implements ActionListener { balanceDisplay.setBounds(543, 82, 85, 14); balanceDisplay.setFont(new Font("Tahoma", Font.BOLD, 12)); contentPane.add(balanceDisplay); - + textExpensesName = new JTextField(); textExpensesName.setBounds(60, 221, 128, 20); textExpensesName.setToolTipText(""); contentPane.add(textExpensesName); textExpensesName.setColumns(10); - + ausgabenName = new JLabel(" Name"); ausgabenName.setBounds(10, 224, 46, 14); contentPane.add(ausgabenName); - + ausgabenBetrag = new JLabel(" Betrag"); ausgabenBetrag.setBounds(10, 253, 46, 14); contentPane.add(ausgabenBetrag); - + budgetBetrag = new JLabel(" Betrag"); budgetBetrag.setBounds(10, 100, 46, 14); contentPane.add(budgetBetrag); - + JScrollPane scrollPane_1 = new JScrollPane(); scrollPane_1.setBounds(323, 126, 197, 88); contentPane.add(scrollPane_1); - + myTable = new JTable(); - myTable.setModel(new DefaultTableModel( - new Object[][] { - }, - new String[] { - "Name", "Kosten" - } - ) { - Class[] columnTypes = new Class[] { - String.class, Integer.class - }; + myTable.setModel(new DefaultTableModel(new Object[][] {}, new String[] { "Name", "Kosten" }) { + Class[] columnTypes = new Class[] { String.class, Integer.class }; + public Class getColumnClass(int columnIndex) { return columnTypes[columnIndex]; } - boolean[] columnEditables = new boolean[] { - false, true - }; + + boolean[] columnEditables = new boolean[] { false, false }; + public boolean isCellEditable(int row, int column) { return columnEditables[column]; } @@ -253,8 +245,9 @@ public class MeinGui extends JFrame implements ActionListener { expensesDisplay.setText(setExpensesView()); balance = Integer.parseInt(text1.getText()) - Integer.parseInt(text2.getText()); balanceDisplay.setText(setBalanceView()); - } + } + } public void exitButton() { @@ -267,9 +260,9 @@ public class MeinGui extends JFrame implements ActionListener { budgetDispaly.setText(null); expensesDisplay.setText(null); balanceDisplay.setText(null); + ((DefaultTableModel)myTable.getModel()).setRowCount(0); } - public static String setBudgetView() { String result = budget + " €"; return result; @@ -283,5 +276,6 @@ public class MeinGui extends JFrame implements ActionListener { public static String setBalanceView() { String result = balance + " €"; return result; - } + } + } From 9b63770209fd07e1ce03e1b1aca2b0cef7b227a7 Mon Sep 17 00:00:00 2001 From: Adah Boukhari Date: Tue, 4 Feb 2020 00:43:59 +0100 Subject: [PATCH 2/3] Commit_29 Funktionalitaet add (Table) implementiert --- .../bin/MeinBudgetView/MeinGui.class | Bin 6922 -> 7107 bytes .../src/MeinBudgetView/MeinGui.java | 4 +++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Budget Projekt/bin/MeinBudgetView/MeinGui.class b/Budget Projekt/bin/MeinBudgetView/MeinGui.class index 7902d792f14eed3889d7eb4f29f393cf41d63179..2bad1bdf45dbfc91e3c444453a9425125326e905 100644 GIT binary patch delta 761 zcmaiwPfQb05XR^0pIy4{R-u8mpah~Ipn(z;Oi&Vw0<|E2s%V7@i(P7KZ53NgJZNHK zV!V-e@v0uYc#x8;jYebO=EV?WhzBnoO^gR`8jZ8m(8LSx@Vu^e6)H~98 zCeabfM{H=7VqEh` zlQ=KqoJeW)eGHgVF-^xoJ8l>`2J~n1nVgJ^Aa8kKB)5>vB!c;5I&Lf|^aHb&MO}2d zYrQd=tw0>)X!vsXnSvPRRU~j(%(;7|7*Z;(tUPf)m87X%w=3!X%2@Tf%{53)vhyO= zM4RtnPl3Lf2)@O@$U*08x)-$<=#z=&NYqiFTO1V8R>V-m#PBlr*r|)}KH4eX`?@-R z(qsBXtMr==akimEg$oM5n2#}x6S$@k6Nr!vXGEjFsphN&vTcGCR<0liAg2B8ktolE z36>8mhYR$vBpW69=hSZELYYxdGBX?`!%1#PR1KMSqk{IrMFA+{v%ld^ELuRIh?y6d z^Wc&R!$dON_WVB|8hPQ~{EEt^ylgm)t6by4QM7WVnd2}yEW@lW(L3%nBDdVN8NZ*!Uxz)by!kS^CtcR+AQv6SZj3 zvSk;f{sK25sW3^42%=5kqHUX?RkVp{DX902qO|h6@SXd?Ip?1HeZKrEExvAl_y{1) znN@Mdl)ucg&8D4qCLVS>j|ZIboGaMQYdSlK$OEU~)aRVp>3aLweBOOzAchu!Crk_c zX4c?!cFRUH#a?;eJYU_zK7;*eAwu(RzJKm%W^Q3NuXBKizpjX%5ctO-gEx7L&Es)8Ro#4O@ID4p7OEOfZ{d=fVtX8xQ>aO?d6gNEt@3+SZLH0cX(gE`5x3#T zj*MCtf}Lx4<Ty*0L^kePWNV$Qy_BQ_ulw(CI^%eneS@Y6eh49VrIoqLpm2hu4_e z;NW`>ALs2NM~WQF*1h}xNrn)oQOasS?FkwuI4S>H))i0Rs4OOr^oStA$^(zYzDHNW j8udJykJLw1hS-6AKZBQ(ZmCakTH!IZqH_wp`m+bSYVB`| diff --git a/Budget Projekt/src/MeinBudgetView/MeinGui.java b/Budget Projekt/src/MeinBudgetView/MeinGui.java index 75db528..a0fe154 100644 --- a/Budget Projekt/src/MeinBudgetView/MeinGui.java +++ b/Budget Projekt/src/MeinBudgetView/MeinGui.java @@ -197,7 +197,7 @@ public class MeinGui extends JFrame implements ActionListener { contentPane.add(budgetBetrag); JScrollPane scrollPane_1 = new JScrollPane(); - scrollPane_1.setBounds(323, 126, 197, 88); + scrollPane_1.setBounds(347, 126, 136, 88); contentPane.add(scrollPane_1); myTable = new JTable(); @@ -247,6 +247,8 @@ public class MeinGui extends JFrame implements ActionListener { balanceDisplay.setText(setBalanceView()); } + DefaultTableModel tab = (DefaultTableModel)myTable.getModel(); + tab.addRow(new Object [] {(textExpensesName.getText()) , Integer.parseInt(text2.getText())}); } From 3c4d110777bc44e59d3847f3bf093321432a9bed Mon Sep 17 00:00:00 2001 From: Adah Boukhari Date: Tue, 4 Feb 2020 01:11:21 +0100 Subject: [PATCH 3/3] Commit_30 Table angepasst --- .../bin/MeinBudgetView/MeinGui$1.class | Bin 738 -> 738 bytes .../bin/MeinBudgetView/MeinGui$2.class | Bin 1110 -> 1110 bytes .../bin/MeinBudgetView/MeinGui.class | Bin 7107 -> 7392 bytes .../src/MeinBudgetView/MeinGui.java | 10 ++++++++++ 4 files changed, 10 insertions(+) diff --git a/Budget Projekt/bin/MeinBudgetView/MeinGui$1.class b/Budget Projekt/bin/MeinBudgetView/MeinGui$1.class index 46a9523230d4bc896f7d4ec0362845373b3be2ad..83412196ab26e3b5475a768542720ded8e56c4bb 100644 GIT binary patch delta 35 qcmaFF`iOOd3KOHy9kTmqgk~z z6Pr#R-lo;GO&w~9Oj8HJt~)VgthSD(vDI4Zn19l7OkbHaF-e;=F{bD4Zb&A*cV^Go z@BGgB&i$QpzVFohzbrIfz4_8B0Pf_jBSyI=V&I>6*Ti+aN91-};p$MJrz6;41+4Yq z_E4}g5D4{JenKl;Gpoq~e_-O@4migFTY^X7{)m;(u`8nhw?IlW{>kb!HBFnzu$x>a^?VXwO)Tn;s%% zd8j*V1r36!CW>hiRfQ{_$;h_<;JMAkG?VGfuvKGjN~Xyyj<**Zvs1E7=5V6jWt1~} zWXQ;(r-Zk=cpH&tU-#zeCQCWnek*n6ygN+JMG0Y8eeL0@o^Uu6G(djcWiQ z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+pC59G^*|GyYuc@Gg^eoNjGN8RV?t43l>= zzx7N?1&x7lqs$tX+SLWPU;@Va)j?ASlu)(wC6C5^}FCH%n7$=nL=@G>SePI!1{93Z$S?GJ6a1 zFcQ~e6ow)^T9(IRBF3Q(RhWhGScC~!E-R~X8`fhIUdQcd!yWh-HTV>h@g=6VxTp7aA=+mC2$hZc#^>BAU+qYA-Jn&CqhxQl`p@BrT|}WjIY#ht{SYV!CKf z?FVf;FBe0X+Q@V4Aevj^Y-UGhz$0!l*$G5Xaa|4rN&?zZ7-g39;@%cGr2V=jK6kYs zDaP*7x>5Fwv7nX3iJf2zGG%!u(jo{q?}Qn_z8L#Nd2PbL*MjnPgCWxKJ25E2Vo~BS zwXGZw!DlgEFZLI~|G8Zf!TuO;Y~L304BgIQBa4Jx%c@lb2LweJcF{f@I4Vp!Ap|%nR5^tOIE|G!BUCwybvTFjg%Ea) zy2TR{uaSK3;24gTw5>x9$FWLkG+tJn&{M+R!gE4I+Os;IR|$gh%7joc-g=SC!e332 z4yh&EeMrr1ql6EaJ=JAJ3WIvvQl8$D9!6O$myL^kA|z*@#l?PGgxd#i z)>js6YCmKrIer;0GQ!fSHkN&x49Uw(HprLD{x>90D`k4ws9oZy0|dDCf05IW&Gd`F v+5Z5R-$??vJ=`ooPQ+XCA5`m5c8}b6JQ@RHr!go44M>xl=ZdtSBXRK;$KS>s diff --git a/Budget Projekt/src/MeinBudgetView/MeinGui.java b/Budget Projekt/src/MeinBudgetView/MeinGui.java index a0fe154..f690b85 100644 --- a/Budget Projekt/src/MeinBudgetView/MeinGui.java +++ b/Budget Projekt/src/MeinBudgetView/MeinGui.java @@ -23,6 +23,11 @@ import javax.swing.JSeparator; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.table.DefaultTableModel; +import javax.swing.border.EtchedBorder; +import javax.swing.border.MatteBorder; +import javax.swing.border.BevelBorder; +import javax.swing.border.TitledBorder; +import javax.swing.UIManager; public class MeinGui extends JFrame implements ActionListener { @@ -201,6 +206,10 @@ public class MeinGui extends JFrame implements ActionListener { contentPane.add(scrollPane_1); myTable = new JTable(); + myTable.setColumnSelectionAllowed(true); + myTable.setCellSelectionEnabled(true); + myTable.setBorder(UIManager.getBorder("Tree.editorBorder")); + myTable.setFont(new Font("Tahoma", Font.BOLD, 11)); myTable.setModel(new DefaultTableModel(new Object[][] {}, new String[] { "Name", "Kosten" }) { Class[] columnTypes = new Class[] { String.class, Integer.class }; @@ -262,6 +271,7 @@ public class MeinGui extends JFrame implements ActionListener { budgetDispaly.setText(null); expensesDisplay.setText(null); balanceDisplay.setText(null); + textExpensesName.setText(null); ((DefaultTableModel)myTable.getModel()).setRowCount(0); }