@@ -257,31 +257,35 @@ public void changed() {
257257 // 책 관련링크 라벨
258258 JLabel bookLinkLabel = new JLabel ("\uAD00 \uB828 \uB9C1 \uD06C : " );
259259 bookLinkLabel .setFont (new Font ("한컴산뜻돋움" , Font .PLAIN , 16 ));
260- bookLinkLabel .setBounds (12 , 203 , 83 , 26 );
260+ bookLinkLabel .setBounds (12 , 216 , 83 , 26 );
261261 panel_1 .add (bookLinkLabel );
262262
263263 // 책 관련링크 텍스트필드
264264 bookLinkTextField = new JTextField ();
265265 bookLinkTextField .setFont (new Font ("한컴산뜻돋움" , Font .PLAIN , 16 ));
266266 bookLinkTextField .setColumns (10 );
267- bookLinkTextField .setBounds (92 , 203 , 407 , 26 );
267+ bookLinkTextField .setBounds (92 , 216 , 407 , 26 );
268268 panel_1 .add (bookLinkTextField );
269269
270270 // 책 가격 라벨
271271 JLabel bookPriceLabel = new JLabel ("\uAC00 \uACA9 : " );
272272 bookPriceLabel .setFont (new Font ("한컴산뜻돋움" , Font .PLAIN , 16 ));
273- bookPriceLabel .setBounds (12 , 107 , 46 , 26 );
273+ bookPriceLabel .setBounds (12 , 118 , 46 , 26 );
274274 panel_1 .add (bookPriceLabel );
275275
276-
276+ JLabel lblNewLabel_1 = new JLabel ("" );
277+ lblNewLabel_1 .setForeground (Color .RED );
278+ lblNewLabel_1 .setBounds (91 , 145 , 225 , 15 );
279+ panel_1 .add (lblNewLabel_1 );
277280 // 책 가격 텍스트필드
278281 bookPriceTextField = new JTextField ();
279282 bookPriceTextField .setFont (new Font ("한컴산뜻돋움" , Font .PLAIN , 16 ));
280283 bookPriceTextField .setColumns (10 );
281- bookPriceTextField .setBounds (92 , 107 , 407 , 26 );
284+ bookPriceTextField .setBounds (92 , 118 , 407 , 26 );
282285 panel_1 .add (bookPriceTextField );
283286 bookPriceTextField .getDocument ().addDocumentListener (new DocumentListener () {
284287 public void changedUpdate (DocumentEvent e ) {
288+
285289 changed ();
286290 }
287291 public void removeUpdate (DocumentEvent e ) {
@@ -290,31 +294,46 @@ public void removeUpdate(DocumentEvent e) {
290294 public void insertUpdate (DocumentEvent e ) {
291295 changed ();
292296 }
293-
297+
294298 public void changed () {
295299 if (bookISBNTextField .getText ().equals ("" )){
296300 bookAddButton .setEnabled (false );
297301 }
298302 else {
299303 bookAddButton .setEnabled (true );
300304 }
305+
306+ if (bookPriceTextField .getText ().length () > 10 ) {
307+ bookAddButton .setEnabled (false );
308+ lblNewLabel_1 .setText ("가격은 10자리 이하만 가능합니다." );
309+ }else {
310+ bookAddButton .setEnabled (true );
311+ lblNewLabel_1 .setText ("" );
312+ }
301313
302314 }
303315 });
304316
305317 // 책 ISBN 라벨
306318 JLabel bookISBNLabel = new JLabel ("ISBN : " );
307319 bookISBNLabel .setFont (new Font ("한컴산뜻돋움" , Font .PLAIN , 16 ));
308- bookISBNLabel .setBounds (12 , 154 , 58 , 26 );
320+ bookISBNLabel .setBounds (12 , 170 , 58 , 26 );
309321 panel_1 .add (bookISBNLabel );
310322
311323
312324 // 책 ISBN 텍스트필드
313325 bookISBNTextField = new JTextField ();
314326 bookISBNTextField .setFont (new Font ("한컴산뜻돋움" , Font .PLAIN , 16 ));
315327 bookISBNTextField .setColumns (10 );
316- bookISBNTextField .setBounds (92 , 154 , 407 , 26 );
328+ bookISBNTextField .setBounds (92 , 170 , 407 , 26 );
317329 panel_1 .add (bookISBNTextField );
330+
331+ JLabel lblNewLabel = new JLabel ("" );
332+ lblNewLabel .setForeground (Color .RED );
333+ lblNewLabel .setBounds (91 , 202 , 225 , 15 );
334+ panel_1 .add (lblNewLabel );
335+
336+
318337 bookISBNTextField .getDocument ().addDocumentListener (new DocumentListener () {
319338 public void changedUpdate (DocumentEvent e ) {
320339 changed ();
@@ -333,6 +352,14 @@ public void changed() {
333352 else {
334353 bookAddButton .setEnabled (true );
335354 }
355+
356+ if (bookISBNTextField .getText ().length () > 13 ) {
357+ bookAddButton .setEnabled (false );
358+ lblNewLabel .setText ("ISBN은 13자리 이하만 가능합니다." );
359+ }else {
360+ bookAddButton .setEnabled (true );
361+ lblNewLabel .setText ("" );
362+ }
336363
337364 }
338365 });
0 commit comments