本文的目的是介绍如何在NetBeansGUIBuilder中包含自定义面板?的详细情况,特别关注netbeans做界面的相关信息。我们将通过专业的研究、有关数据的分析等多种方式,为您呈现一个全面的了解
本文的目的是介绍如何在NetBeans GUI Builder中包含自定义面板?的详细情况,特别关注netbeans做界面的相关信息。我们将通过专业的研究、有关数据的分析等多种方式,为您呈现一个全面的了解如何在NetBeans GUI Builder中包含自定义面板?的机会,同时也不会遗漏关于com.google.android.gms.analytics.HitBuilders.EventBuilder的实例源码、Eclipse WindowBuilder中自定义Java Bean的属性的空下拉列表、ios – 如何在Interface Builder中使用自定义UIButton?、java – 在NetBeans GUI Designer中重用JPanel的知识。
本文目录一览:- 如何在NetBeans GUI Builder中包含自定义面板?(netbeans做界面)
- com.google.android.gms.analytics.HitBuilders.EventBuilder的实例源码
- Eclipse WindowBuilder中自定义Java Bean的属性的空下拉列表
- ios – 如何在Interface Builder中使用自定义UIButton?
- java – 在NetBeans GUI Designer中重用JPanel
如何在NetBeans GUI Builder中包含自定义面板?(netbeans做界面)
我写了一个扩展JPanel的类。是否可以在NetBeans GUI Builder中使用它,并使它在所有自动代码生成中都可以生存?
我在GUI生成器中使用了自定义代码选项将对象实例化为新类,但似乎无法从JPanel更改声明,因此仅调用已覆盖的方法,而不能调用new
JPanel中不存在的那些。
答案1
小编典典只需将类从项目树拖到GUI设计器中的表单上即可。
com.google.android.gms.analytics.HitBuilders.EventBuilder的实例源码
@Override public void sendEvent(String category,String action,String label,Long value) { try { EventBuilder builder = new HitBuilders.EventBuilder(category,action); if (label != null) { builder.setLabel(label); } if (value != null) { builder.setValue(value); } mTracker.send(builder.build()); } catch (Throwable t) { if (AndroidUtils.DEBUG) { Log.e(TAG,"sendEvent",t); } } }
@Override public void onClick(final View v) { switch (v.getId()) { case R.id.button_reset_password: { if (isInputValid()) { GoogleAnalyticsManager .getInstance() .sendEvent( new EventBuilder(Categories.CONVERSION,Actions.SIGN_IN_ATTEMPT) .set(ParamKeys.TYPE,ParamValues.RESET) ); callPasswordReset(mTokenEditText.getText().toString(),mNewPasswordEditText.getText().toString(),mEmailId); } break; } } }
/** * Send a specific event. * * @param category The event category. * @param action The action. * @param label The label. * @param value An associated value. */ public static void sendEvent(final Category category,final String action,final String label,final Long value) { getDefaultTracker(); EventBuilder eventBuilder = new EventBuilder(); eventBuilder.setCategory(category.toString()); if (action != null) { eventBuilder.setAction(action); } if (label == null) { eventBuilder.setLabel(action); } else { eventBuilder.setLabel(action + " - " + label); } if (value != null) { eventBuilder.setValue(value); } mTracker.send(eventBuilder.build()); }
public static void sendHitNewGame() { if (Statistics.tracker != null) { Thread threadGameMode = new Thread(new Runnable() { @Override public void run() { EventBuilder builder = new HitBuilders.EventBuilder(); builder.setCategory(Statistics.CATEGORY_GAME); builder.setAction(Statistics.EVENT_NEW_GAME); Statistics.tracker.send(builder.build()); } }); threadGameMode.start(); } }
public static void sendHitCollision(final CollisionType collisionType) { if (Statistics.tracker != null) { Thread threadGameMode = new Thread(new Runnable() { @Override public void run() { EventBuilder builder = new HitBuilders.EventBuilder(); builder.setCategory(Statistics.CATEGORY_COLLISION); builder.setAction(collisionType.toString()); Statistics.tracker.send(builder.build()); } }); threadGameMode.start(); } }
public synchronized void sendAppLaunched() { threadPool.submit(new Runnable() { @Override public void run() { tracker.setScreenName("App Launched"); tracker.send(new HitBuilders.Screenviewbuilder().build()); } }); threadPool.submit(new Runnable() { @Override public void run() { Date date = new Date(); Calendar calendar = GregorianCalendar.getInstance(); calendar.setTime(date); int hour = calendar.get(Calendar.HOUR_OF_DAY); EventBuilder eventBuilder = new HitBuilders.EventBuilder(); eventBuilder.setCategory("TIME_APP_OPEN"); eventBuilder.setAction(String.valueOf(hour)); tracker.send(eventBuilder.build()); } }); }
public synchronized void addedCartItem(final CartItem cartItem) { threadPool.submit(new Runnable() { @Override public void run() { EventBuilder eventBuilder = new HitBuilders.EventBuilder(); eventBuilder.setCategory("ADDED_PRODUCT_TO_CART"); eventBuilder.setAction(cartItem.getCategory().getName()); tracker.send(eventBuilder.build()); } }); }
/** * Track event. * * @param context * @param category of event,see CAT_XX constants * @param action action of event * @param label of event * @param value of event */ public static void sendEvent(Context context,String category,Long value) { if (!GHConstants.DEBUG) { Tracker t = getTracker(context); if (t != null) { EventBuilder eb = new HitBuilders.EventBuilder(); eb.setCategory(category).setAction(action).setLabel(label); if (value != null) { eb.setValue(value); } t.send(eb.build()); } } }
@Override public void onReceive(Context context,Intent intent) { if (mSlidingLayout.isExpanded()) { GoogleAnalyticsManager .getInstance() .sendEvent(new EventBuilder(Categories.USAGE,Actions.CHAT_INITIALIZATION) .set(ParamKeys.TYPE,ParamValues.PROFILE)); } else { GoogleAnalyticsManager .getInstance() .sendEvent(new EventBuilder(Categories.USAGE,ParamValues.BOOK)); } }
@Override public void onDialogClick(final DialogInterface dialog,final int which) { if ((mAddBookDialogFragment != null) && mAddBookDialogFragment.getDialog().equals(dialog)) { if (which == 0) { // scan book startActivityForResult(new Intent(getActivity(),ScanIsbnActivity.class),RequestCodes.SCAN_ISBN); GoogleAnalyticsManager .getInstance() .sendEvent(new EventBuilder(Categories.USAGE,Actions.ADD_BOOK) .set(ParamKeys.TYPE,ParamValues.SCAN)); } else if (which == 1) { // add book manually loadAddOrEditBookFragment(null); GoogleAnalyticsManager .getInstance() .sendEvent(new EventBuilder(Categories.USAGE,ParamValues.MANUAL)); } } else if ((mEnableLocationDialogFragment != null) && mEnableLocationDialogFragment.getDialog() .equals(dialog)) { if (which == DialogInterface.BUTTON_POSITIVE) { // enable location Intent locationoptionsIntent = new Intent( android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS); startActivity(locationoptionsIntent); } else if (which == DialogInterface.BUTTON_NEGATIVE) { // cancel dialog.cancel(); } } else { super.onDialogClick(dialog,which); } }
@Override public void onItemClick(final AdapterView<?> parent,final View view,final int position,final long id) { if (parent.getId() == R.id.grid_profile_books) { if (!mUserId.equals(UserInfo.INSTANCE.getId())) { GoogleAnalyticsManager.getInstance().sendEvent( new EventBuilder(Categories.USAGE,Actions.BOOK_PROFILE_CLICK)); } final Cursor cursor = (Cursor) mProfileBooksAdapter .getItem(position); final String bookId = cursor.getString(cursor.getColumnIndex(DatabaseColumns.ID)); final Intent bookDetailIntent = new Intent(getActivity(),BookDetailActivity.class); bookDetailIntent.putExtra(Keys.ID,bookId); startActivity(bookDetailIntent); /*final Bundle showBooksArgs = Utils.cursorToBundle(cursor); loadFragment(R.id.frame_content,(AbstractBarterLiFragment) Fragment .instantiate(getActivity(),BookDetailFragment.class .getName(),showBooksArgs),FragmentTags.USER_BOOK_FROM_PROFILE,true,FragmentTags.BS_EDIT_PROFILE );*/ } }
/** * Inform an event to Google Analytics * * @param builder */ public void sendEvent(EventBuilder builder) { builder.set(ParamKeys.LOGGED_IN,TextUtils.isEmpty(UserInfo.INSTANCE .getId()) ? ParamValues.NO : ParamValues.YES); mApplicationTracker.send(builder.build()); }
/** * Sends to Google Analytics an event. * * @param tracker The analytics tracker to use when sending the * event. * @param eventCategory Category of the event * @param eventAction Action of the event * @param eventlabel label of the event */ public static void analytics_sendEvent (Tracker tracker,String eventCategory,String eventAction,String eventlabel,Long eventValue) { EventBuilder eBuilder = new HitBuilders.EventBuilder(); eBuilder.setCategory(eventCategory) .setAction(eventAction) .setLabel(eventlabel); if(eventValue!=null) { eBuilder.setValue(eventValue); } tracker.send(eBuilder.build()); }
@Override public void onClick(final View v) { switch (v.getId()) { case R.id.button_facebook_login: { GoogleAnalyticsManager .getInstance() .sendEvent(new EventBuilder(Categories.CONVERSION,Actions.SIGN_IN_ATTEMPT) .set(ParamKeys.TYPE,ParamValues.FACEBOOK)); final Session session = Session.getActiveSession(); if (!session.isOpened() && !session.isClosed()) { session.openForRead(new Session.OpenRequest(this) .setPermissions(Arrays .asList(AppConstants .FBPERMISSIONS)) .setCallback(this)); } else { Session.openActiveSession(getActivity(),this,this); } break; } case R.id.button_google_login: { GoogleAnalyticsManager .getInstance() .sendEvent(new EventBuilder(Categories.CONVERSION,ParamValues.GOOGLE)); ((AuthActivity) getActivity()).getPlusManager().login(); break; } case R.id.button_submit: { if (isInputValid()) { GoogleAnalyticsManager .getInstance() .sendEvent( new EventBuilder(Categories.CONVERSION,ParamValues.EMAIL) ); login(mEmailEditText.getText().toString(),mPasswordEditText .getText().toString()); } break; } case R.id.forgot_password: { showForgotPasswordDialog(); } } }
Eclipse WindowBuilder中自定义Java Bean的属性的空下拉列表
在Project > Properties > Java Build Path > Libraries
中用Oracle JDK替换OpenJDK并重建Java Bean类为我解决了这个问题。
ios – 如何在Interface Builder中使用自定义UIButton?
@implementation BlaButtonVC - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { NSArray *subViews = [[NSBundle mainBundle] loadNibNamed:@"BlaButton" owner:self options:nil]; [self addSubview:subViews[0]]; } return self; } @end
我可以将此按钮添加到视图中,如下所示:
// ViewController.m BlaButtonVC *button = [[BlaButtonVC alloc] initWithFrame:CGRectMake(10,10,280,44)]; button.titleXLabel.text = @"Nyuff"; button.descLabel.text = @"Kukk"; [self.view addSubview:button];
我的问题是我不知道如何从Interface Bulder这样做,如何使用这个UIButton子类而不是正常的子类.
已将Button Type更改为Custom,将Custom Class更改为BlaButtonVC,但这还不够.它将调用BlaButtonVC initWithFrame,但按钮不会出现在Interface Builder中,也不会出现在Simulator中.
我错过了什么?
在这里您可以找到完整的样本:
https://www.dropbox.com/s/ioucpb6jn6nr0hs/blabla1.zip
解决方法
java – 在NetBeans GUI Designer中重用JPanel
NetBeans GUI Designer中有以下层次结构:
JFrame JTabbedPane JPanel X <...> JPanel JButton JPanel Y <...> JButton
题:
JPanel Y与JPanel X相同,所以我想在两个地方简单地重用JPanel X,但是如何在GUI Builder中执行此操作?
尝试:
我尝试复制粘贴JPanel X,但它创建了一个完整的“深”副本(JPanel X1等),复制JPanel X中的所有内容.
有些谷歌搜索表示可能将它添加到调色板,但是我还没有找到一种方法来添加一个简单的JPanel到调色板(而不是一个完整的JFrame).
解决方法
或者,您可以单击使用Bean,然后键入类的名称.
或者,您可以从托盘中进行添加,并将扫描JAR以查找任何“beans”.它也应该拿起你的定制JPanel.
关于如何在NetBeans GUI Builder中包含自定义面板?和netbeans做界面的介绍现已完结,谢谢您的耐心阅读,如果想了解更多关于com.google.android.gms.analytics.HitBuilders.EventBuilder的实例源码、Eclipse WindowBuilder中自定义Java Bean的属性的空下拉列表、ios – 如何在Interface Builder中使用自定义UIButton?、java – 在NetBeans GUI Designer中重用JPanel的相关知识,请在本站寻找。
本文标签: