Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

14
LINES

< > BotCompany Repo | #1006455 // getTextTrim - getText() from JTextComponent, trim

JavaX fragment (include)

static S getTextTrim(JTextComponent c) {
  ret trim(getText(c));
}

// tested for editable combo box - returns the contents of text field
static S getTextTrim(JComboBox cb) {
  ret trim(getText(cb));
}

static S getTextTrim(JComponent c) {
  if (c instanceof JLabel) ret trim(((JLabel) c).getText());
  if (c instanceof JComboBox) ret getTextTrim((JComboBox) c);
  ret getTextTrim((JTextComponent) c);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1006455
Snippet name: getTextTrim - getText() from JTextComponent, trim
Eternal ID of this version: #1006455/6
Text MD5: 3a1de0debcdd9917f749892022361785
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-10-15 16:49:59
Source code size: 416 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 615 / 666
Version history: 5 change(s)
Referenced in: #1006642 - getText - get entered text/selected item from JTextComponent or JComboBox (thread-safe)
#1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1009787 - getTextTrimAndClear - getText() from JTextComponent, trim, empty input field
#1010557 - gtt - synonym of getTextTrim - getText() from JTextComponent, trim